本文整理汇总了Golang中github.com/pomack/dsocial/go/models/dsocial.Contact.Id方法的典型用法代码示例。如果您正苦于以下问题:Golang Contact.Id方法的具体用法?Golang Contact.Id怎么用?Golang Contact.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pomack/dsocial/go/models/dsocial.Contact
的用法示例。
在下文中一共展示了Contact.Id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: StoreDsocialContact
// Stores dsocial contact
// Returns:
// dsocialContact : the contact, modified to include items like Id and LastModified/Created
// err : error or nil
func (p *InMemoryDataStore) StoreDsocialContact(dsocialUserId, dsocialContactId string, contact *dm.Contact) (dsocialContact *dm.Contact, err os.Error) {
if dsocialContactId == "" {
dsocialContactId = p.GenerateId(dsocialUserId, "contact")
fmt.Printf("[DS]: Generated Id for storing dsocial contact: %v\n", dsocialContactId)
contact.Id = dsocialContactId
} else {
fmt.Printf("[DS]: Using existing contact id: %v\n", dsocialContactId)
}
bc.AddIdsForDsocialContact(contact, p, dsocialUserId)
//k := strings.Join([]string{dsocialUserId, dsocialContactId}, "/")
c := new(dm.Contact)
*c = *contact
p.store(dsocialUserId, _INMEMORY_CONTACT_COLLECTION_NAME, dsocialContactId, c)
dsocialContact = contact
return
}
示例2: StoreDsocialContactForExternalContact
// Stores dsocial contact
// Returns:
// dsocialContact : the contact, modified to include items like Id and LastModified/Created
// err : error or nil
func (p *InMemoryDataStore) StoreDsocialContactForExternalContact(externalServiceId, externalUserId, externalContactId, dsocialUserId string, contact *dm.Contact) (dsocialContact *dm.Contact, err os.Error) {
//k := strings.Join([]string{dsocialUserId, externalServiceId, externalUserId, externalContactId}, "/")
k := strings.Join([]string{externalServiceId, externalUserId, externalContactId}, "|")
if externalServiceId == "" || externalUserId == "" || externalContactId == "" {
panic(fmt.Sprintf("One of the following three strings are empty: externalServiceId: %s, externalUserId: %s, externalContactId: %s\n", externalServiceId, externalUserId, externalContactId))
} else if strings.Contains(externalServiceId, "|") || strings.Contains(externalUserId, "|") || strings.Contains(externalContactId, "|") {
panic(fmt.Sprintf("One of the following three strings contain pipe character: externalServiceId: %s, externalUserId: %s, externalContactId: %s\n", externalServiceId, externalUserId, externalContactId))
}
extid := dsocialUserId + "/" + k
bc.AddIdsForDsocialContact(contact, p, dsocialUserId)
c := new(dm.Contact)
*c = *contact
c.Id = extid
p.store(dsocialUserId, _INMEMORY_CONTACT_FOR_EXTERNAL_CONTACT_COLLECTION_NAME, extid, c)
dsocialContact = contact
return
}
示例3: AddIdsForDsocialContact
func AddIdsForDsocialContact(c *dm.Contact, ds DataStoreService, dsocialUserId string) (err os.Error) {
if c == nil {
return
}
if c.UserId == "" {
c.UserId = dsocialUserId
}
if c.Acl.OwnerId == "" {
c.Acl.OwnerId = dsocialUserId
}
if c.Id == "" {
c.Id = ds.GenerateId(dsocialUserId, "contact")
}
if c.PostalAddresses != nil {
for _, addr := range c.PostalAddresses {
if addr.Acl.OwnerId == "" {
addr.Acl.OwnerId = dsocialUserId
}
if addr.Id == "" {
addr.Id = ds.GenerateId(dsocialUserId, "address")
}
}
}
if c.Educations != nil {
for _, ed := range c.Educations {
if ed.Acl.OwnerId == "" {
ed.Acl.OwnerId = dsocialUserId
}
if ed.Id == "" {
ed.Id = ds.GenerateId(dsocialUserId, "education")
}
}
}
if c.WorkHistories != nil {
for _, wh := range c.WorkHistories {
if wh.Acl.OwnerId == "" {
wh.Acl.OwnerId = dsocialUserId
}
if wh.Id == "" {
wh.Id = ds.GenerateId(dsocialUserId, "workhistory")
}
}
}
if c.PhoneNumbers != nil {
for _, p := range c.PhoneNumbers {
if p.Acl.OwnerId == "" {
p.Acl.OwnerId = dsocialUserId
}
if p.Id == "" {
p.Id = ds.GenerateId(dsocialUserId, "phone")
}
}
}
if c.EmailAddresses != nil {
for _, e := range c.EmailAddresses {
if e.Acl.OwnerId == "" {
e.Acl.OwnerId = dsocialUserId
}
if e.Id == "" {
e.Id = ds.GenerateId(dsocialUserId, "email")
}
}
}
if c.Uris != nil {
for _, u := range c.Uris {
if u.Acl.OwnerId == "" {
u.Acl.OwnerId = dsocialUserId
}
if u.Id == "" {
u.Id = ds.GenerateId(dsocialUserId, "uri")
}
}
}
if c.Ims != nil {
for _, im := range c.Ims {
if im.Acl.OwnerId == "" {
im.Acl.OwnerId = dsocialUserId
}
if im.Id == "" {
im.Id = ds.GenerateId(dsocialUserId, "im")
}
}
}
if c.Relationships != nil {
for _, r := range c.Relationships {
if r.Acl.OwnerId == "" {
r.Acl.OwnerId = dsocialUserId
}
if r.Id == "" {
r.Id = ds.GenerateId(dsocialUserId, "relationship")
}
}
}
if c.Dates != nil {
for _, d := range c.Dates {
if d.Acl.OwnerId == "" {
d.Acl.OwnerId = dsocialUserId
}
if d.Id == "" {
d.Id = ds.GenerateId(dsocialUserId, "date")
//.........这里部分代码省略.........