當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Group.Id方法代碼示例

本文整理匯總了Golang中github.com/pomack/dsocial/go/models/dsocial.Group.Id方法的典型用法代碼示例。如果您正苦於以下問題:Golang Group.Id方法的具體用法?Golang Group.Id怎麽用?Golang Group.Id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/pomack/dsocial/go/models/dsocial.Group的用法示例。


在下文中一共展示了Group.Id方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: StoreDsocialGroup

// Stores dsocial group
// Returns:
//   dsocialGroup : the group, modified to include items like Id and LastModified/Created
//   err : error or nil
func (p *InMemoryDataStore) StoreDsocialGroup(dsocialUserId, dsocialGroupId string, group *dm.Group) (dsocialGroup *dm.Group, err os.Error) {
	if dsocialGroupId == "" {
		dsocialGroupId = p.GenerateId(dsocialUserId, "group")
		fmt.Printf("[DS]: Generated Id for storing dsocial group: %v\n", dsocialGroupId)
		group.Id = dsocialGroupId
	} else {
		fmt.Printf("[DS]: Using existing group id: %v\n", dsocialGroupId)
	}
	//k := strings.Join([]string{dsocialUserId, dsocialGroupId}, "/")
	g := new(dm.Group)
	*g = *group
	p.store(dsocialUserId, _INMEMORY_GROUP_COLLECTION_NAME, dsocialGroupId, g)
	dsocialGroup = group
	return
}
開發者ID:pombredanne,項目名稱:dsocial.go,代碼行數:19,代碼來源:contacts_service.go

示例2: AddIdsForDsocialGroup

func AddIdsForDsocialGroup(g *dm.Group, ds DataStoreService, dsocialUserId string) (err os.Error) {
	if g == nil {
		return
	}
	if g.UserId == "" {
		g.UserId = dsocialUserId
	}
	if g.Acl.OwnerId == "" {
		g.Acl.OwnerId = dsocialUserId
	}
	if g.Id == "" {
		g.Id = ds.GenerateId(dsocialUserId, "group")
	}
	return
}
開發者ID:pombredanne,項目名稱:dsocial.go,代碼行數:15,代碼來源:service.go

示例3: StoreDsocialGroupForExternalGroup

// Stores dsocial group
// Returns:
//   dsocialGroup : the group, modified to include items like Id and LastModified/Created
//   err : error or nil
func (p *InMemoryDataStore) StoreDsocialGroupForExternalGroup(externalServiceId, externalUserId, externalGroupId, dsocialUserId string, group *dm.Group) (dsocialGroup *dm.Group, err os.Error) {
	//k := strings.Join([]string{dsocialUserId, externalServiceId, externalUserId, externalGroupId}, "/")
	k := strings.Join([]string{externalServiceId, externalUserId, externalGroupId}, "|")
	if externalServiceId == "" || externalUserId == "" || externalGroupId == "" {
		panic(fmt.Sprintf("One of the following three strings are empty: externalServiceId: %s, externalUserId: %s, externalGroupId: %s\n", externalServiceId, externalUserId, externalGroupId))
	} else if strings.Contains(externalServiceId, "|") || strings.Contains(externalUserId, "|") || strings.Contains(externalGroupId, "|") {
		panic(fmt.Sprintf("One of the following three strings contain pipe character: externalServiceId: %s, externalUserId: %s, externalGroupId: %s\n", externalServiceId, externalUserId, externalGroupId))
	}
	extid := dsocialUserId + "/" + k
	bc.AddIdsForDsocialGroup(group, p, dsocialUserId)
	g := new(dm.Group)
	*g = *group
	g.Id = extid
	fmt.Printf("[DS]: Storing %s with id %v for %s\n", _INMEMORY_GROUP_FOR_EXTERNAL_GROUP_COLLECTION_NAME, extid, g.Name)
	p.store(dsocialUserId, _INMEMORY_GROUP_FOR_EXTERNAL_GROUP_COLLECTION_NAME, extid, g)
	dsocialGroup = group
	return
}
開發者ID:pombredanne,項目名稱:dsocial.go,代碼行數:22,代碼來源:contacts_service.go


注:本文中的github.com/pomack/dsocial/go/models/dsocial.Group.Id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。