• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang datastore.ResRow类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/ctdk/goiardi/datastore.ResRow的典型用法代码示例。如果您正苦于以下问题:Golang ResRow类的具体用法?Golang ResRow怎么用?Golang ResRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ResRow类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: fillRoleFromSQL

func (r *Role) fillRoleFromSQL(row datastore.ResRow) error {
	var (
		rl []byte
		er []byte
		da []byte
		oa []byte
	)
	err := row.Scan(&r.Name, &r.Description, &rl, &er, &da, &oa)
	if err != nil {
		return err
	}
	r.ChefType = "role"
	r.JSONClass = "Chef::Role"
	err = datastore.DecodeBlob(rl, &r.RunList)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(er, &r.EnvRunLists)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(da, &r.Default)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(oa, &r.Override)
	if err != nil {
		return err
	}
	datastore.ChkNilArray(r)

	return nil
}
开发者ID:ranjib,项目名称:goiardi,代码行数:33,代码来源:sql_funcs.go


示例2: fillLogEventFromPostgreSQL

func (le *LogInfo) fillLogEventFromPostgreSQL(row datastore.ResRow) error {
	err := row.Scan(&le.ID, &le.ActorType, &le.ActorInfo, &le.Time, &le.Action, &le.ObjectType, &le.ObjectName, &le.ExtendedInfo)
	if err != nil {
		return err
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:7,代码来源:postgres_funcs.go


示例3: fillEnvFromSQL

// Fill an environment in from a row returned from the SQL server. See the
// equivalent function in node/node.go for more details.
//
// As there, the SQL query that made the row needs to have the same number &
// order of columns as the one in Get(), even if the WHERE clause is different
// or omitted.
func (e *ChefEnvironment) fillEnvFromSQL(row datastore.ResRow) error {
	var (
		da []byte
		oa []byte
		cv []byte
	)
	err := row.Scan(&e.Name, &e.Description, &da, &oa, &cv)
	if err != nil {
		return err
	}
	e.ChefType = "environment"
	e.JSONClass = "Chef::Environment"
	err = datastore.DecodeBlob(da, &e.Default)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(oa, &e.Override)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(cv, &e.CookbookVersions)
	if err != nil {
		return err
	}
	datastore.ChkNilArray(e)
	return nil
}
开发者ID:ranjib,项目名称:goiardi,代码行数:33,代码来源:sql_funcs.go


示例4: fillCookbookFromSQL

func (c *Cookbook) fillCookbookFromSQL(row datastore.ResRow) error {
	err := row.Scan(&c.id, &c.Name)
	if err != nil {
		return err
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:7,代码来源:sql_funcs.go


示例5: fillClientFromSQL

func (c *Client) fillClientFromSQL(row datastore.ResRow) error {
	err := row.Scan(&c.Name, &c.NodeName, &c.Validator, &c.Admin, &c.Orgname, &c.pubKey, &c.Certificate)
	if err != nil {
		return err
	}
	c.ChefType = "client"
	c.JSONClass = "Chef::ApiClient"
	return nil
}
开发者ID:ranjib,项目名称:goiardi,代码行数:9,代码来源:sql_funcs.go


示例6: fillShoveyRunStreamFromMySQL

func (srs *ShoveyRunStream) fillShoveyRunStreamFromMySQL(row datastore.ResRow) error {
	var ca mysql.NullTime
	err := row.Scan(&srs.ShoveyUUID, &srs.NodeName, &srs.Seq, &srs.OutputType, &srs.Output, &srs.IsLast, &ca)
	if err != nil {
		return err
	}
	if ca.Valid {
		srs.CreatedAt = ca.Time
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:11,代码来源:mysql_funcs.go


示例7: fillNodeStatusFromMySQL

func (ns *NodeStatus) fillNodeStatusFromMySQL(row datastore.ResRow) error {
	var ua mysql.NullTime
	err := row.Scan(&ns.Status, &ua)
	if err != nil {
		return nil
	}
	if ua.Valid {
		ns.UpdatedAt = ua.Time
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:11,代码来源:mysql_funcs.go


示例8: fillSandboxFromPostgreSQL

func (s *Sandbox) fillSandboxFromPostgreSQL(row datastore.ResRow) error {
	var csb []byte
	err := row.Scan(&s.ID, &s.CreationTime, &csb, &s.Completed)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(csb, &s.Checksums)
	if err != nil {
		return err
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:12,代码来源:postgres_funcs.go


示例9: fillLogEventFromMySQL

func (le *LogInfo) fillLogEventFromMySQL(row datastore.ResRow) error {
	var tb []byte
	err := row.Scan(&le.ID, &le.ActorType, &le.ActorInfo, &tb, &le.Action, &le.ObjectType, &le.ObjectName, &le.ExtendedInfo)
	if err != nil {
		return err
	}
	le.Time, err = time.Parse(datastore.MySQLTimeFormat, string(tb))
	if err != nil {
		return err
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:12,代码来源:mysql_funcs.go


示例10: fillUserFromSQL

func (u *User) fillUserFromSQL(row datastore.ResRow) error {
	var email sql.NullString
	err := row.Scan(&u.Username, &u.Name, &u.Admin, &u.pubKey, &email, &u.passwd, &u.salt)
	if err != nil {
		return err
	}
	if !email.Valid {
		u.Email = ""
	} else {
		u.Email = email.String
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:13,代码来源:sql_funcs.go


示例11: fillShoveyRunFromMySQL

func (sr *ShoveyRun) fillShoveyRunFromMySQL(row datastore.ResRow) error {
	var at, et mysql.NullTime
	err := row.Scan(&sr.ID, &sr.ShoveyUUID, &sr.NodeName, &sr.Status, &at, &et, &sr.Error, &sr.ExitStatus)
	if err != nil {
		return err
	}
	if at.Valid {
		sr.AckTime = at.Time
	}
	if et.Valid {
		sr.EndTime = et.Time
	}
	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:14,代码来源:mysql_funcs.go


示例12: fillDBItemFromMySQL

func (dbi *DataBagItem) fillDBItemFromMySQL(row datastore.ResRow) error {
	var rawb []byte
	err := row.Scan(&dbi.id, &dbi.dataBagID, &dbi.Name, &dbi.origName, &dbi.DataBagName, &rawb)
	if err != nil {
		return err
	}
	dbi.ChefType = "data_bag_item"
	dbi.JSONClass = "Chef::DataBagItem"
	err = datastore.DecodeBlob(rawb, &dbi.RawData)
	if err != nil {
		return err
	}
	datastore.ChkNilArray(dbi)
	return nil
}
开发者ID:ranjib,项目名称:goiardi,代码行数:15,代码来源:sql_funcs.go


示例13: fillShoveyFromMySQL

func (s *Shovey) fillShoveyFromMySQL(row datastore.ResRow) error {
	var ca, ua mysql.NullTime
	var tm int64
	err := row.Scan(&s.RunID, &s.Command, &ca, &ua, &s.Status, &tm, &s.Quorum)
	if err != nil {
		return err
	}
	if ca.Valid {
		s.CreatedAt = ca.Time
	}
	if ua.Valid {
		s.UpdatedAt = ua.Time
	}
	s.Timeout = time.Duration(tm)

	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:17,代码来源:mysql_funcs.go


示例14: fillShoveyFromPostgreSQL

func (s *Shovey) fillShoveyFromPostgreSQL(row datastore.ResRow) error {
	var ca, ua pq.NullTime
	var nn util.StringSlice
	var tm int64
	err := row.Scan(&s.RunID, &nn, &s.Command, &ca, &ua, &s.Status, &tm, &s.Quorum)
	if err != nil {
		return err
	}
	if ca.Valid {
		s.CreatedAt = ca.Time
	}
	if ua.Valid {
		s.UpdatedAt = ua.Time
	}
	s.Timeout = time.Duration(tm)

	s.NodeNames = nn

	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:20,代码来源:postgres_funcs.go


示例15: fillReportFromMySQL

func (r *Report) fillReportFromMySQL(row datastore.ResRow) error {
	var res, dat []byte
	var st, et mysql.NullTime
	err := row.Scan(&r.RunID, &st, &et, &r.TotalResCount, &r.Status, &r.RunList, &res, &dat, &r.NodeName)
	if err != nil {
		return err
	}
	if err = datastore.DecodeBlob(res, &r.Resources); err != nil {
		return err
	}
	if err = datastore.DecodeBlob(dat, &r.Data); err != nil {
		return err
	}
	if st.Valid {
		r.StartTime = st.Time
	}
	if et.Valid {
		r.EndTime = et.Time
	}

	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:22,代码来源:mysql_funcs.go


示例16: fillNodeFromSQL

// Fill in a node from a row returned from the SQL server. Useful for the case
// down the road where an array of objects is needed, but building it with
// a call to GetList(), then repeated calls to Get() sucks with a real db even
// if it's marginally acceptable in in-memory mode.
//
// NB: This does require the query to look like the one in Get().
func (n *Node) fillNodeFromSQL(row datastore.ResRow) error {
	var (
		rl []byte
		aa []byte
		na []byte
		da []byte
		oa []byte
	)
	err := row.Scan(&n.Name, &n.ChefEnvironment, &rl, &aa, &na, &da, &oa)
	if err != nil {
		return err
	}
	n.ChefType = "node"
	n.JSONClass = "Chef::Node"
	err = datastore.DecodeBlob(rl, &n.RunList)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(aa, &n.Automatic)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(na, &n.Normal)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(da, &n.Default)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(oa, &n.Override)
	if err != nil {
		return err
	}
	datastore.ChkNilArray(n)
	return nil
}
开发者ID:ranjib,项目名称:goiardi,代码行数:43,代码来源:sql_funcs.go


示例17: fillCookbookVersionFromSQL

func (cbv *CookbookVersion) fillCookbookVersionFromSQL(row datastore.ResRow) error {
	var (
		defb  []byte
		libb  []byte
		attb  []byte
		recb  []byte
		prob  []byte
		resb  []byte
		temb  []byte
		roob  []byte
		filb  []byte
		metb  []byte
		major int64
		minor int64
		patch int64
	)
	err := row.Scan(&cbv.id, &cbv.cookbookID, &defb, &libb, &attb, &recb, &prob, &resb, &temb, &roob, &filb, &metb, &major, &minor, &patch, &cbv.IsFrozen, &cbv.CookbookName)
	if err != nil {
		return err
	}
	/* Now... populate it. :-/ */
	// These may need to accept x.y versions with only two elements
	// instead of x.y.0 with the added default 0 patch number.
	cbv.Version = fmt.Sprintf("%d.%d.%d", major, minor, patch)
	cbv.Name = fmt.Sprintf("%s-%s", cbv.CookbookName, cbv.Version)
	cbv.ChefType = "cookbook_version"
	cbv.JSONClass = "Chef::CookbookVersion"

	/* TODO: experiment some more with getting this done with
	 * pointers. */
	err = datastore.DecodeBlob(metb, &cbv.Metadata)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(defb, &cbv.Definitions)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(libb, &cbv.Libraries)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(attb, &cbv.Attributes)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(recb, &cbv.Recipes)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(prob, &cbv.Providers)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(temb, &cbv.Templates)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(resb, &cbv.Resources)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(roob, &cbv.RootFiles)
	if err != nil {
		return err
	}
	err = datastore.DecodeBlob(filb, &cbv.Files)
	if err != nil {
		return err
	}
	datastore.ChkNilArray(cbv)

	return nil
}
开发者ID:rajthilakmca,项目名称:goiardi,代码行数:74,代码来源:sql_funcs.go



注:本文中的github.com/ctdk/goiardi/datastore.ResRow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang util.CastErr函数代码示例发布时间:2022-05-23
下一篇:
Golang datastore.Dbhandle类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap