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


Golang Contact.UserId方法代碼示例

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


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

示例1: 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")
//.........這裏部分代碼省略.........
開發者ID:pombredanne,項目名稱:dsocial.go,代碼行數:101,代碼來源:service.go


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