当前位置: 首页>>代码示例>>Golang>>正文


Golang ResRow.Scan方法代码示例

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


在下文中一共展示了ResRow.Scan方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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