本文整理汇总了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
}
示例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
}
示例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
}