本文整理汇总了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
}
示例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
}
示例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
}
示例4: fillCookbookFromSQL
func (c *Cookbook) fillCookbookFromSQL(row datastore.ResRow) error {
err := row.Scan(&c.id, &c.Name)
if err != nil {
return err
}
return nil
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}