本文整理汇总了Golang中github.com/jackc/pgx.Rows.Err方法的典型用法代码示例。如果您正苦于以下问题:Golang Rows.Err方法的具体用法?Golang Rows.Err怎么用?Golang Rows.Err使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jackc/pgx.Rows
的用法示例。
在下文中一共展示了Rows.Err方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: scanFormations
func scanFormations(rows *pgx.Rows) ([]*ct.Formation, error) {
var formations []*ct.Formation
for rows.Next() {
formation, err := scanFormation(rows)
if err != nil {
rows.Close()
return nil, err
}
formations = append(formations, formation)
}
return formations, rows.Err()
}
示例2: releaseList
func releaseList(rows *pgx.Rows) ([]*ct.Release, error) {
var releases []*ct.Release
for rows.Next() {
release, err := scanRelease(rows)
if err != nil {
rows.Close()
return nil, err
}
releases = append(releases, release)
}
return releases, rows.Err()
}
示例3: listExpanded
func (r *FormationRepo) listExpanded(rows *pgx.Rows) ([]*ct.ExpandedFormation, error) {
defer rows.Close()
var formations []*ct.ExpandedFormation
// artifactIDs is a list of artifact IDs related to the formation list
// and is used to populate the formation's artifact fields using a
// subsequent artifact list query
artifactIDs := make(map[string]struct{})
for rows.Next() {
formation, err := scanExpandedFormation(rows)
if err != nil {
return nil, err
}
formations = append(formations, formation)
for _, id := range formation.Release.ArtifactIDs {
artifactIDs[id] = struct{}{}
}
}
if len(artifactIDs) > 0 {
ids := make([]string, 0, len(artifactIDs))
for id := range artifactIDs {
ids = append(ids, id)
}
artifacts, err := r.artifacts.ListIDs(ids...)
if err != nil {
return nil, err
}
for _, formation := range formations {
populateFormationArtifacts(formation, artifacts)
}
}
return formations, rows.Err()
}