当前位置: 首页>>代码示例>>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;未经允许,请勿转载。