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


Golang datastore.ResRow類代碼示例

本文整理匯總了Golang中github.com/ctdk/goiardi/datastore.ResRow的典型用法代碼示例。如果您正苦於以下問題:Golang ResRow類的具體用法?Golang ResRow怎麽用?Golang ResRow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ResRow類的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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。