diff --git a/satellite/satellitedb/dbx/satellitedb.dbx.go b/satellite/satellitedb/dbx/satellitedb.dbx.go index fb854c66c..c2d5e330f 100644 --- a/satellite/satellitedb/dbx/satellitedb.dbx.go +++ b/satellite/satellitedb/dbx/satellitedb.dbx.go @@ -10656,24 +10656,36 @@ func (obj *pgxImpl) Limited_Irreparabledb_By_Segmentpath_Greater_OrderBy_Asc_Seg var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Irreparabledb, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - irreparabledb := &Irreparabledb{} - err = __rows.Scan(&irreparabledb.Segmentpath, &irreparabledb.Segmentdetail, &irreparabledb.PiecesLostCount, &irreparabledb.SegDamagedUnixSec, &irreparabledb.RepairAttemptCount) + for __rows.Next() { + irreparabledb := &Irreparabledb{} + err = __rows.Scan(&irreparabledb.Segmentpath, &irreparabledb.Segmentdetail, &irreparabledb.PiecesLostCount, &irreparabledb.SegDamagedUnixSec, &irreparabledb.RepairAttemptCount) + if err != nil { + return nil, err + } + rows = append(rows, irreparabledb) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, irreparabledb) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -10715,24 +10727,35 @@ func (obj *pgxImpl) All_AccountingRollup_By_StartTime_GreaterOrEqual(ctx context var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*AccountingRollup, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - accounting_rollup := &AccountingRollup{} - err = __rows.Scan(&accounting_rollup.NodeId, &accounting_rollup.StartTime, &accounting_rollup.PutTotal, &accounting_rollup.GetTotal, &accounting_rollup.GetAuditTotal, &accounting_rollup.GetRepairTotal, &accounting_rollup.PutRepairTotal, &accounting_rollup.AtRestTotal) + for __rows.Next() { + accounting_rollup := &AccountingRollup{} + err = __rows.Scan(&accounting_rollup.NodeId, &accounting_rollup.StartTime, &accounting_rollup.PutTotal, &accounting_rollup.GetTotal, &accounting_rollup.GetAuditTotal, &accounting_rollup.GetRepairTotal, &accounting_rollup.PutRepairTotal, &accounting_rollup.AtRestTotal) + if err != nil { + return nil, err + } + rows = append(rows, accounting_rollup) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, accounting_rollup) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -10769,24 +10792,35 @@ func (obj *pgxImpl) All_Node_Id(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Id_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_Row{} - err = __rows.Scan(&row.Id) + for __rows.Next() { + row := &Id_Row{} + err = __rows.Scan(&row.Id) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -10806,24 +10840,36 @@ func (obj *pgxImpl) Limited_Node_By_Id_GreaterOrEqual_OrderBy_Asc_Id(ctx context var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Node, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - node := &Node{} - err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.LastIpPort, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.VettedAt, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.Suspended, &node.UnknownAuditSuspended, &node.OfflineSuspended, &node.UnderReview, &node.OnlineScore, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UnknownAuditReputationAlpha, &node.UnknownAuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt, &node.ExitSuccess) + for __rows.Next() { + node := &Node{} + err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.LastIpPort, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.VettedAt, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.Suspended, &node.UnknownAuditSuspended, &node.OfflineSuspended, &node.UnderReview, &node.OnlineScore, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UnknownAuditReputationAlpha, &node.UnknownAuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt, &node.ExitSuccess) + if err != nil { + return nil, err + } + rows = append(rows, node) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, node) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -10838,24 +10884,35 @@ func (obj *pgxImpl) All_Node_Id_Node_PieceCount_By_PieceCount_Not_Number(ctx con var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Id_PieceCount_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_PieceCount_Row{} - err = __rows.Scan(&row.Id, &row.PieceCount) + for __rows.Next() { + row := &Id_PieceCount_Row{} + err = __rows.Scan(&row.Id, &row.PieceCount) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -10873,24 +10930,36 @@ func (obj *pgxImpl) Limited_Node_Id_Node_Address_Node_LastIpPort_Node_LastContac var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} - err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + for __rows.Next() { + row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} + err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -10907,24 +10976,35 @@ func (obj *pgxImpl) All_Node_Id_Node_Address_Node_LastIpPort_Node_LastContactSuc var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} - err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + for __rows.Next() { + row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} + err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -10963,35 +11043,49 @@ func (obj *pgxImpl) Get_User_By_NormalizedEmail_And_Status_Not_Number(ctx contex var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + user, err = func() (user *User, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, sql.ErrNoRows + } + + user = &User{} + err = __rows.Scan(&user.Id, &user.Email, &user.NormalizedEmail, &user.FullName, &user.ShortName, &user.PasswordHash, &user.Status, &user.PartnerId, &user.CreatedAt, &user.ProjectLimit) + if err != nil { + return nil, err + } + + if __rows.Next() { + return nil, errTooManyRows + } + + if err := __rows.Err(); err != nil { + return nil, err + } + + return user, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows("User_By_NormalizedEmail_And_Status_Not_Number") + } return nil, obj.makeErr(err) } - return nil, makeErr(sql.ErrNoRows) + return user, nil } - user = &User{} - err = __rows.Scan(&user.Id, &user.Email, &user.NormalizedEmail, &user.FullName, &user.ShortName, &user.PasswordHash, &user.Status, &user.PartnerId, &user.CreatedAt, &user.ProjectLimit) - if err != nil { - return nil, obj.makeErr(err) - } - - if __rows.Next() { - return nil, tooManyRows("User_By_NormalizedEmail_And_Status_Not_Number") - } - - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - - return user, nil - } func (obj *pgxImpl) Get_User_By_Id(ctx context.Context, @@ -11159,24 +11253,35 @@ func (obj *pgxImpl) All_Project(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11193,24 +11298,35 @@ func (obj *pgxImpl) All_Project_By_CreatedAt_Less_OrderBy_Asc_CreatedAt(ctx cont var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11227,24 +11343,35 @@ func (obj *pgxImpl) All_Project_By_OwnerId_OrderBy_Asc_CreatedAt(ctx context.Con var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11261,24 +11388,35 @@ func (obj *pgxImpl) All_Project_By_ProjectMember_MemberId_OrderBy_Asc_Project_Na var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11298,24 +11436,36 @@ func (obj *pgxImpl) Limited_Project_By_CreatedAt_Less_OrderBy_Asc_CreatedAt(ctx var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11332,24 +11482,35 @@ func (obj *pgxImpl) All_ProjectMember_By_MemberId(ctx context.Context, var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*ProjectMember, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project_member := &ProjectMember{} - err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + for __rows.Next() { + project_member := &ProjectMember{} + err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project_member) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project_member) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11369,24 +11530,36 @@ func (obj *pgxImpl) Limited_ProjectMember_By_ProjectId(ctx context.Context, var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*ProjectMember, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project_member := &ProjectMember{} - err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + for __rows.Next() { + project_member := &ProjectMember{} + err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project_member) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project_member) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11470,24 +11643,35 @@ func (obj *pgxImpl) All_ApiKey_By_ProjectId_OrderBy_Asc_Name(ctx context.Context var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*ApiKey, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - api_key := &ApiKey{} - err = __rows.Scan(&api_key.Id, &api_key.ProjectId, &api_key.Head, &api_key.Name, &api_key.Secret, &api_key.PartnerId, &api_key.CreatedAt) + for __rows.Next() { + api_key := &ApiKey{} + err = __rows.Scan(&api_key.Id, &api_key.ProjectId, &api_key.Head, &api_key.Name, &api_key.Secret, &api_key.PartnerId, &api_key.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, api_key) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, api_key) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11504,35 +11688,49 @@ func (obj *pgxImpl) Get_SerialNumber_BucketId_By_SerialNumber(ctx context.Contex var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + row, err = func() (row *BucketId_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, sql.ErrNoRows + } + + row = &BucketId_Row{} + err = __rows.Scan(&row.BucketId) + if err != nil { + return nil, err + } + + if __rows.Next() { + return nil, errTooManyRows + } + + if err := __rows.Err(); err != nil { + return nil, err + } + + return row, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows("SerialNumber_BucketId_By_SerialNumber") + } return nil, obj.makeErr(err) } - return nil, makeErr(sql.ErrNoRows) + return row, nil } - row = &BucketId_Row{} - err = __rows.Scan(&row.BucketId) - if err != nil { - return nil, obj.makeErr(err) - } - - if __rows.Next() { - return nil, tooManyRows("SerialNumber_BucketId_By_SerialNumber") - } - - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - - return row, nil - } func (obj *pgxImpl) Find_SerialNumber_By_SerialNumber(ctx context.Context, @@ -11548,35 +11746,49 @@ func (obj *pgxImpl) Find_SerialNumber_By_SerialNumber(ctx context.Context, var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + serial_number, err = func() (serial_number *SerialNumber, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, nil + } + + serial_number = &SerialNumber{} + err = __rows.Scan(&serial_number.Id, &serial_number.SerialNumber, &serial_number.BucketId, &serial_number.ExpiresAt) + if err != nil { + return nil, err + } + + if __rows.Next() { + return nil, errTooManyRows + } + + if err := __rows.Err(); err != nil { + return nil, err + } + + return serial_number, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows("SerialNumber_By_SerialNumber") + } return nil, obj.makeErr(err) } - return nil, nil + return serial_number, nil } - serial_number = &SerialNumber{} - err = __rows.Scan(&serial_number.Id, &serial_number.SerialNumber, &serial_number.BucketId, &serial_number.ExpiresAt) - if err != nil { - return nil, obj.makeErr(err) - } - - if __rows.Next() { - return nil, tooManyRows("SerialNumber_By_SerialNumber") - } - - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - - return serial_number, nil - } func (obj *pgxImpl) Paged_PendingSerialQueue(ctx context.Context, @@ -11600,29 +11812,41 @@ func (obj *pgxImpl) Paged_PendingSerialQueue(ctx context.Context, } obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, next, err = func() (rows []*PendingSerialQueue, next *Paged_PendingSerialQueue_Continuation, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, nil, err + } + defer __rows.Close() - var __continuation Paged_PendingSerialQueue_Continuation - __continuation._set = true + var __continuation Paged_PendingSerialQueue_Continuation + __continuation._set = true - for __rows.Next() { - pending_serial_queue := &PendingSerialQueue{} - err = __rows.Scan(&pending_serial_queue.StorageNodeId, &pending_serial_queue.BucketId, &pending_serial_queue.SerialNumber, &pending_serial_queue.Action, &pending_serial_queue.Settled, &pending_serial_queue.ExpiresAt, &__continuation._value_storage_node_id, &__continuation._value_bucket_id, &__continuation._value_serial_number) + for __rows.Next() { + pending_serial_queue := &PendingSerialQueue{} + err = __rows.Scan(&pending_serial_queue.StorageNodeId, &pending_serial_queue.BucketId, &pending_serial_queue.SerialNumber, &pending_serial_queue.Action, &pending_serial_queue.Settled, &pending_serial_queue.ExpiresAt, &__continuation._value_storage_node_id, &__continuation._value_bucket_id, &__continuation._value_serial_number) + if err != nil { + return nil, nil, err + } + rows = append(rows, pending_serial_queue) + next = &__continuation + } + + if err := __rows.Err(); err != nil { + return nil, nil, err + } + + return rows, next, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, nil, obj.makeErr(err) } - rows = append(rows, pending_serial_queue) - next = &__continuation + return rows, next, nil } - if err := __rows.Err(); err != nil { - return nil, nil, obj.makeErr(err) - } - - return rows, next, nil } @@ -11715,27 +11939,38 @@ func (obj *pgxImpl) First_BucketStorageTally_By_ProjectId_OrderBy_Desc_IntervalS var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + bucket_storage_tally, err := func() (bucket_storage_tally *BucketStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, nil + } + + bucket_storage_tally = &BucketStorageTally{} + err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + if err != nil { + return nil, err + } + + return bucket_storage_tally, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - return nil, nil + return bucket_storage_tally, nil } - bucket_storage_tally = &BucketStorageTally{} - err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) - if err != nil { - return nil, obj.makeErr(err) - } - - return bucket_storage_tally, nil - } func (obj *pgxImpl) All_BucketStorageTally(ctx context.Context) ( @@ -11749,24 +11984,35 @@ func (obj *pgxImpl) All_BucketStorageTally(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*BucketStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_storage_tally := &BucketStorageTally{} - err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + for __rows.Next() { + bucket_storage_tally := &BucketStorageTally{} + err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + if err != nil { + return nil, err + } + rows = append(rows, bucket_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11786,24 +12032,35 @@ func (obj *pgxImpl) All_BucketStorageTally_By_ProjectId_And_BucketName_And_Inter var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*BucketStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_storage_tally := &BucketStorageTally{} - err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + for __rows.Next() { + bucket_storage_tally := &BucketStorageTally{} + err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + if err != nil { + return nil, err + } + rows = append(rows, bucket_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11821,24 +12078,35 @@ func (obj *pgxImpl) All_StoragenodeBandwidthRollup_By_StoragenodeId_And_Interval var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*StoragenodeBandwidthRollup, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} - err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled) + for __rows.Next() { + storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} + err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled) + if err != nil { + return nil, err + } + rows = append(rows, storagenode_bandwidth_rollup) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, storagenode_bandwidth_rollup) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11866,29 +12134,41 @@ func (obj *pgxImpl) Paged_StoragenodeBandwidthRollup_By_StoragenodeId_And_Interv } obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, next, err = func() (rows []*StoragenodeBandwidthRollup, next *Paged_StoragenodeBandwidthRollup_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, nil, err + } + defer __rows.Close() - var __continuation Paged_StoragenodeBandwidthRollup_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation - __continuation._set = true + var __continuation Paged_StoragenodeBandwidthRollup_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation + __continuation._set = true - for __rows.Next() { - storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} - err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + for __rows.Next() { + storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} + err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + if err != nil { + return nil, nil, err + } + rows = append(rows, storagenode_bandwidth_rollup) + next = &__continuation + } + + if err := __rows.Err(); err != nil { + return nil, nil, err + } + + return rows, next, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, nil, obj.makeErr(err) } - rows = append(rows, storagenode_bandwidth_rollup) - next = &__continuation + return rows, next, nil } - if err := __rows.Err(); err != nil { - return nil, nil, obj.makeErr(err) - } - - return rows, next, nil } @@ -11916,29 +12196,41 @@ func (obj *pgxImpl) Paged_StoragenodeBandwidthRollupPhase2_By_StoragenodeId_And_ } obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, next, err = func() (rows []*StoragenodeBandwidthRollupPhase2, next *Paged_StoragenodeBandwidthRollupPhase2_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, nil, err + } + defer __rows.Close() - var __continuation Paged_StoragenodeBandwidthRollupPhase2_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation - __continuation._set = true + var __continuation Paged_StoragenodeBandwidthRollupPhase2_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation + __continuation._set = true - for __rows.Next() { - storagenode_bandwidth_rollup_phase2 := &StoragenodeBandwidthRollupPhase2{} - err = __rows.Scan(&storagenode_bandwidth_rollup_phase2.StoragenodeId, &storagenode_bandwidth_rollup_phase2.IntervalStart, &storagenode_bandwidth_rollup_phase2.IntervalSeconds, &storagenode_bandwidth_rollup_phase2.Action, &storagenode_bandwidth_rollup_phase2.Allocated, &storagenode_bandwidth_rollup_phase2.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + for __rows.Next() { + storagenode_bandwidth_rollup_phase2 := &StoragenodeBandwidthRollupPhase2{} + err = __rows.Scan(&storagenode_bandwidth_rollup_phase2.StoragenodeId, &storagenode_bandwidth_rollup_phase2.IntervalStart, &storagenode_bandwidth_rollup_phase2.IntervalSeconds, &storagenode_bandwidth_rollup_phase2.Action, &storagenode_bandwidth_rollup_phase2.Allocated, &storagenode_bandwidth_rollup_phase2.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + if err != nil { + return nil, nil, err + } + rows = append(rows, storagenode_bandwidth_rollup_phase2) + next = &__continuation + } + + if err := __rows.Err(); err != nil { + return nil, nil, err + } + + return rows, next, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, nil, obj.makeErr(err) } - rows = append(rows, storagenode_bandwidth_rollup_phase2) - next = &__continuation + return rows, next, nil } - if err := __rows.Err(); err != nil { - return nil, nil, obj.makeErr(err) - } - - return rows, next, nil } @@ -11953,24 +12245,35 @@ func (obj *pgxImpl) All_StoragenodeStorageTally(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*StoragenodeStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - storagenode_storage_tally := &StoragenodeStorageTally{} - err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + for __rows.Next() { + storagenode_storage_tally := &StoragenodeStorageTally{} + err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + if err != nil { + return nil, err + } + rows = append(rows, storagenode_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, storagenode_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -11987,24 +12290,35 @@ func (obj *pgxImpl) All_StoragenodeStorageTally_By_IntervalEndTime_GreaterOrEqua var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*StoragenodeStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - storagenode_storage_tally := &StoragenodeStorageTally{} - err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + for __rows.Next() { + storagenode_storage_tally := &StoragenodeStorageTally{} + err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + if err != nil { + return nil, err + } + rows = append(rows, storagenode_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, storagenode_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12178,24 +12492,35 @@ func (obj *pgxImpl) All_Offer_OrderBy_Asc_Id(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Offer, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - offer := &Offer{} - err = __rows.Scan(&offer.Id, &offer.Name, &offer.Description, &offer.AwardCreditInCents, &offer.InviteeCreditInCents, &offer.AwardCreditDurationDays, &offer.InviteeCreditDurationDays, &offer.RedeemableCap, &offer.ExpiresAt, &offer.CreatedAt, &offer.Status, &offer.Type) + for __rows.Next() { + offer := &Offer{} + err = __rows.Scan(&offer.Id, &offer.Name, &offer.Description, &offer.AwardCreditInCents, &offer.InviteeCreditInCents, &offer.AwardCreditDurationDays, &offer.InviteeCreditDurationDays, &offer.RedeemableCap, &offer.ExpiresAt, &offer.CreatedAt, &offer.Status, &offer.Type) + if err != nil { + return nil, err + } + rows = append(rows, offer) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, offer) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12213,24 +12538,35 @@ func (obj *pgxImpl) All_UserCredit_By_UserId_And_ExpiresAt_Greater_And_CreditsUs var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*UserCredit, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - user_credit := &UserCredit{} - err = __rows.Scan(&user_credit.Id, &user_credit.UserId, &user_credit.OfferId, &user_credit.ReferredBy, &user_credit.Type, &user_credit.CreditsEarnedInCents, &user_credit.CreditsUsedInCents, &user_credit.ExpiresAt, &user_credit.CreatedAt) + for __rows.Next() { + user_credit := &UserCredit{} + err = __rows.Scan(&user_credit.Id, &user_credit.UserId, &user_credit.OfferId, &user_credit.ReferredBy, &user_credit.Type, &user_credit.CreditsEarnedInCents, &user_credit.CreditsUsedInCents, &user_credit.ExpiresAt, &user_credit.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, user_credit) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, user_credit) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12324,24 +12660,36 @@ func (obj *pgxImpl) Limited_BucketMetainfo_By_ProjectId_And_Name_GreaterOrEqual_ var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*BucketMetainfo, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_metainfo := &BucketMetainfo{} - err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + for __rows.Next() { + bucket_metainfo := &BucketMetainfo{} + err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + if err != nil { + return nil, err + } + rows = append(rows, bucket_metainfo) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_metainfo) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12362,24 +12710,36 @@ func (obj *pgxImpl) Limited_BucketMetainfo_By_ProjectId_And_Name_Greater_OrderBy var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*BucketMetainfo, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_metainfo := &BucketMetainfo{} - err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + for __rows.Next() { + bucket_metainfo := &BucketMetainfo{} + err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + if err != nil { + return nil, err + } + rows = append(rows, bucket_metainfo) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_metainfo) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12466,24 +12826,35 @@ func (obj *pgxImpl) All_NodesOfflineTime_By_NodeId_And_TrackedAt_Greater_And_Tra var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*NodesOfflineTime, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - nodes_offline_time := &NodesOfflineTime{} - err = __rows.Scan(&nodes_offline_time.NodeId, &nodes_offline_time.TrackedAt, &nodes_offline_time.Seconds) + for __rows.Next() { + nodes_offline_time := &NodesOfflineTime{} + err = __rows.Scan(&nodes_offline_time.NodeId, &nodes_offline_time.TrackedAt, &nodes_offline_time.Seconds) + if err != nil { + return nil, err + } + rows = append(rows, nodes_offline_time) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, nodes_offline_time) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12525,24 +12896,36 @@ func (obj *pgxImpl) Limited_StripeCustomer_By_CreatedAt_LessOrEqual_OrderBy_Desc var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*StripeCustomer, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - stripe_customer := &StripeCustomer{} - err = __rows.Scan(&stripe_customer.UserId, &stripe_customer.CustomerId, &stripe_customer.CreatedAt) + for __rows.Next() { + stripe_customer := &StripeCustomer{} + err = __rows.Scan(&stripe_customer.UserId, &stripe_customer.CustomerId, &stripe_customer.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, stripe_customer) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, stripe_customer) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12559,24 +12942,35 @@ func (obj *pgxImpl) All_CoinpaymentsTransaction_By_UserId_OrderBy_Desc_CreatedAt var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*CoinpaymentsTransaction, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coinpayments_transaction := &CoinpaymentsTransaction{} - err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + for __rows.Next() { + coinpayments_transaction := &CoinpaymentsTransaction{} + err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coinpayments_transaction) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coinpayments_transaction) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12597,24 +12991,36 @@ func (obj *pgxImpl) Limited_CoinpaymentsTransaction_By_CreatedAt_LessOrEqual_And var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*CoinpaymentsTransaction, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coinpayments_transaction := &CoinpaymentsTransaction{} - err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + for __rows.Next() { + coinpayments_transaction := &CoinpaymentsTransaction{} + err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coinpayments_transaction) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coinpayments_transaction) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12660,24 +13066,36 @@ func (obj *pgxImpl) Limited_StripecoinpaymentsInvoiceProjectRecord_By_PeriodStar var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*StripecoinpaymentsInvoiceProjectRecord, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - stripecoinpayments_invoice_project_record := &StripecoinpaymentsInvoiceProjectRecord{} - err = __rows.Scan(&stripecoinpayments_invoice_project_record.Id, &stripecoinpayments_invoice_project_record.ProjectId, &stripecoinpayments_invoice_project_record.Storage, &stripecoinpayments_invoice_project_record.Egress, &stripecoinpayments_invoice_project_record.Objects, &stripecoinpayments_invoice_project_record.PeriodStart, &stripecoinpayments_invoice_project_record.PeriodEnd, &stripecoinpayments_invoice_project_record.State, &stripecoinpayments_invoice_project_record.CreatedAt) + for __rows.Next() { + stripecoinpayments_invoice_project_record := &StripecoinpaymentsInvoiceProjectRecord{} + err = __rows.Scan(&stripecoinpayments_invoice_project_record.Id, &stripecoinpayments_invoice_project_record.ProjectId, &stripecoinpayments_invoice_project_record.Storage, &stripecoinpayments_invoice_project_record.Egress, &stripecoinpayments_invoice_project_record.Objects, &stripecoinpayments_invoice_project_record.PeriodStart, &stripecoinpayments_invoice_project_record.PeriodEnd, &stripecoinpayments_invoice_project_record.State, &stripecoinpayments_invoice_project_record.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, stripecoinpayments_invoice_project_record) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, stripecoinpayments_invoice_project_record) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12738,24 +13156,35 @@ func (obj *pgxImpl) All_Coupon_By_UserId_OrderBy_Desc_CreatedAt(ctx context.Cont var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12773,24 +13202,35 @@ func (obj *pgxImpl) All_Coupon_By_UserId_And_Status_OrderBy_Desc_CreatedAt(ctx c var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12807,24 +13247,35 @@ func (obj *pgxImpl) All_Coupon_By_Status_OrderBy_Desc_CreatedAt(ctx context.Cont var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12845,24 +13296,36 @@ func (obj *pgxImpl) Limited_Coupon_By_CreatedAt_LessOrEqual_And_Status_OrderBy_D var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -12882,24 +13345,36 @@ func (obj *pgxImpl) Limited_CouponUsage_By_Period_And_Status_Equal_Number(ctx co var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*CouponUsage, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon_usage := &CouponUsage{} - err = __rows.Scan(&coupon_usage.CouponId, &coupon_usage.Amount, &coupon_usage.Status, &coupon_usage.Period) + for __rows.Next() { + coupon_usage := &CouponUsage{} + err = __rows.Scan(&coupon_usage.CouponId, &coupon_usage.Amount, &coupon_usage.Status, &coupon_usage.Period) + if err != nil { + return nil, err + } + rows = append(rows, coupon_usage) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon_usage) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -16968,24 +17443,36 @@ func (obj *pgxcockroachImpl) Limited_Irreparabledb_By_Segmentpath_Greater_OrderB var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Irreparabledb, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - irreparabledb := &Irreparabledb{} - err = __rows.Scan(&irreparabledb.Segmentpath, &irreparabledb.Segmentdetail, &irreparabledb.PiecesLostCount, &irreparabledb.SegDamagedUnixSec, &irreparabledb.RepairAttemptCount) + for __rows.Next() { + irreparabledb := &Irreparabledb{} + err = __rows.Scan(&irreparabledb.Segmentpath, &irreparabledb.Segmentdetail, &irreparabledb.PiecesLostCount, &irreparabledb.SegDamagedUnixSec, &irreparabledb.RepairAttemptCount) + if err != nil { + return nil, err + } + rows = append(rows, irreparabledb) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, irreparabledb) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17027,24 +17514,35 @@ func (obj *pgxcockroachImpl) All_AccountingRollup_By_StartTime_GreaterOrEqual(ct var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*AccountingRollup, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - accounting_rollup := &AccountingRollup{} - err = __rows.Scan(&accounting_rollup.NodeId, &accounting_rollup.StartTime, &accounting_rollup.PutTotal, &accounting_rollup.GetTotal, &accounting_rollup.GetAuditTotal, &accounting_rollup.GetRepairTotal, &accounting_rollup.PutRepairTotal, &accounting_rollup.AtRestTotal) + for __rows.Next() { + accounting_rollup := &AccountingRollup{} + err = __rows.Scan(&accounting_rollup.NodeId, &accounting_rollup.StartTime, &accounting_rollup.PutTotal, &accounting_rollup.GetTotal, &accounting_rollup.GetAuditTotal, &accounting_rollup.GetRepairTotal, &accounting_rollup.PutRepairTotal, &accounting_rollup.AtRestTotal) + if err != nil { + return nil, err + } + rows = append(rows, accounting_rollup) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, accounting_rollup) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17081,24 +17579,35 @@ func (obj *pgxcockroachImpl) All_Node_Id(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Id_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_Row{} - err = __rows.Scan(&row.Id) + for __rows.Next() { + row := &Id_Row{} + err = __rows.Scan(&row.Id) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17118,24 +17627,36 @@ func (obj *pgxcockroachImpl) Limited_Node_By_Id_GreaterOrEqual_OrderBy_Asc_Id(ct var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Node, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - node := &Node{} - err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.LastIpPort, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.VettedAt, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.Suspended, &node.UnknownAuditSuspended, &node.OfflineSuspended, &node.UnderReview, &node.OnlineScore, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UnknownAuditReputationAlpha, &node.UnknownAuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt, &node.ExitSuccess) + for __rows.Next() { + node := &Node{} + err = __rows.Scan(&node.Id, &node.Address, &node.LastNet, &node.LastIpPort, &node.Protocol, &node.Type, &node.Email, &node.Wallet, &node.FreeDisk, &node.PieceCount, &node.Major, &node.Minor, &node.Patch, &node.Hash, &node.Timestamp, &node.Release, &node.Latency90, &node.AuditSuccessCount, &node.TotalAuditCount, &node.VettedAt, &node.UptimeSuccessCount, &node.TotalUptimeCount, &node.CreatedAt, &node.UpdatedAt, &node.LastContactSuccess, &node.LastContactFailure, &node.Contained, &node.Disqualified, &node.Suspended, &node.UnknownAuditSuspended, &node.OfflineSuspended, &node.UnderReview, &node.OnlineScore, &node.AuditReputationAlpha, &node.AuditReputationBeta, &node.UnknownAuditReputationAlpha, &node.UnknownAuditReputationBeta, &node.UptimeReputationAlpha, &node.UptimeReputationBeta, &node.ExitInitiatedAt, &node.ExitLoopCompletedAt, &node.ExitFinishedAt, &node.ExitSuccess) + if err != nil { + return nil, err + } + rows = append(rows, node) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, node) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17150,24 +17671,35 @@ func (obj *pgxcockroachImpl) All_Node_Id_Node_PieceCount_By_PieceCount_Not_Numbe var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Id_PieceCount_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_PieceCount_Row{} - err = __rows.Scan(&row.Id, &row.PieceCount) + for __rows.Next() { + row := &Id_PieceCount_Row{} + err = __rows.Scan(&row.Id, &row.PieceCount) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17185,24 +17717,36 @@ func (obj *pgxcockroachImpl) Limited_Node_Id_Node_Address_Node_LastIpPort_Node_L var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} - err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + for __rows.Next() { + row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} + err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17219,24 +17763,35 @@ func (obj *pgxcockroachImpl) All_Node_Id_Node_Address_Node_LastIpPort_Node_LastC var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} - err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + for __rows.Next() { + row := &Id_Address_LastIpPort_LastContactSuccess_LastContactFailure_Row{} + err = __rows.Scan(&row.Id, &row.Address, &row.LastIpPort, &row.LastContactSuccess, &row.LastContactFailure) + if err != nil { + return nil, err + } + rows = append(rows, row) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, row) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17275,35 +17830,49 @@ func (obj *pgxcockroachImpl) Get_User_By_NormalizedEmail_And_Status_Not_Number(c var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + user, err = func() (user *User, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, sql.ErrNoRows + } + + user = &User{} + err = __rows.Scan(&user.Id, &user.Email, &user.NormalizedEmail, &user.FullName, &user.ShortName, &user.PasswordHash, &user.Status, &user.PartnerId, &user.CreatedAt, &user.ProjectLimit) + if err != nil { + return nil, err + } + + if __rows.Next() { + return nil, errTooManyRows + } + + if err := __rows.Err(); err != nil { + return nil, err + } + + return user, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows("User_By_NormalizedEmail_And_Status_Not_Number") + } return nil, obj.makeErr(err) } - return nil, makeErr(sql.ErrNoRows) + return user, nil } - user = &User{} - err = __rows.Scan(&user.Id, &user.Email, &user.NormalizedEmail, &user.FullName, &user.ShortName, &user.PasswordHash, &user.Status, &user.PartnerId, &user.CreatedAt, &user.ProjectLimit) - if err != nil { - return nil, obj.makeErr(err) - } - - if __rows.Next() { - return nil, tooManyRows("User_By_NormalizedEmail_And_Status_Not_Number") - } - - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - - return user, nil - } func (obj *pgxcockroachImpl) Get_User_By_Id(ctx context.Context, @@ -17471,24 +18040,35 @@ func (obj *pgxcockroachImpl) All_Project(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17505,24 +18085,35 @@ func (obj *pgxcockroachImpl) All_Project_By_CreatedAt_Less_OrderBy_Asc_CreatedAt var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17539,24 +18130,35 @@ func (obj *pgxcockroachImpl) All_Project_By_OwnerId_OrderBy_Asc_CreatedAt(ctx co var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17573,24 +18175,35 @@ func (obj *pgxcockroachImpl) All_Project_By_ProjectMember_MemberId_OrderBy_Asc_P var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17610,24 +18223,36 @@ func (obj *pgxcockroachImpl) Limited_Project_By_CreatedAt_Less_OrderBy_Asc_Creat var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Project, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project := &Project{} - err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + for __rows.Next() { + project := &Project{} + err = __rows.Scan(&project.Id, &project.Name, &project.Description, &project.UsageLimit, &project.BandwidthLimit, &project.RateLimit, &project.MaxBuckets, &project.PartnerId, &project.OwnerId, &project.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17644,24 +18269,35 @@ func (obj *pgxcockroachImpl) All_ProjectMember_By_MemberId(ctx context.Context, var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*ProjectMember, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project_member := &ProjectMember{} - err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + for __rows.Next() { + project_member := &ProjectMember{} + err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project_member) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project_member) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17681,24 +18317,36 @@ func (obj *pgxcockroachImpl) Limited_ProjectMember_By_ProjectId(ctx context.Cont var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*ProjectMember, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - project_member := &ProjectMember{} - err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + for __rows.Next() { + project_member := &ProjectMember{} + err = __rows.Scan(&project_member.MemberId, &project_member.ProjectId, &project_member.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, project_member) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, project_member) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17782,24 +18430,35 @@ func (obj *pgxcockroachImpl) All_ApiKey_By_ProjectId_OrderBy_Asc_Name(ctx contex var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*ApiKey, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - api_key := &ApiKey{} - err = __rows.Scan(&api_key.Id, &api_key.ProjectId, &api_key.Head, &api_key.Name, &api_key.Secret, &api_key.PartnerId, &api_key.CreatedAt) + for __rows.Next() { + api_key := &ApiKey{} + err = __rows.Scan(&api_key.Id, &api_key.ProjectId, &api_key.Head, &api_key.Name, &api_key.Secret, &api_key.PartnerId, &api_key.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, api_key) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, api_key) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -17816,35 +18475,49 @@ func (obj *pgxcockroachImpl) Get_SerialNumber_BucketId_By_SerialNumber(ctx conte var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + row, err = func() (row *BucketId_Row, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, sql.ErrNoRows + } + + row = &BucketId_Row{} + err = __rows.Scan(&row.BucketId) + if err != nil { + return nil, err + } + + if __rows.Next() { + return nil, errTooManyRows + } + + if err := __rows.Err(); err != nil { + return nil, err + } + + return row, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows("SerialNumber_BucketId_By_SerialNumber") + } return nil, obj.makeErr(err) } - return nil, makeErr(sql.ErrNoRows) + return row, nil } - row = &BucketId_Row{} - err = __rows.Scan(&row.BucketId) - if err != nil { - return nil, obj.makeErr(err) - } - - if __rows.Next() { - return nil, tooManyRows("SerialNumber_BucketId_By_SerialNumber") - } - - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - - return row, nil - } func (obj *pgxcockroachImpl) Find_SerialNumber_By_SerialNumber(ctx context.Context, @@ -17860,35 +18533,49 @@ func (obj *pgxcockroachImpl) Find_SerialNumber_By_SerialNumber(ctx context.Conte var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + serial_number, err = func() (serial_number *SerialNumber, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, nil + } + + serial_number = &SerialNumber{} + err = __rows.Scan(&serial_number.Id, &serial_number.SerialNumber, &serial_number.BucketId, &serial_number.ExpiresAt) + if err != nil { + return nil, err + } + + if __rows.Next() { + return nil, errTooManyRows + } + + if err := __rows.Err(); err != nil { + return nil, err + } + + return serial_number, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows("SerialNumber_By_SerialNumber") + } return nil, obj.makeErr(err) } - return nil, nil + return serial_number, nil } - serial_number = &SerialNumber{} - err = __rows.Scan(&serial_number.Id, &serial_number.SerialNumber, &serial_number.BucketId, &serial_number.ExpiresAt) - if err != nil { - return nil, obj.makeErr(err) - } - - if __rows.Next() { - return nil, tooManyRows("SerialNumber_By_SerialNumber") - } - - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - - return serial_number, nil - } func (obj *pgxcockroachImpl) Paged_PendingSerialQueue(ctx context.Context, @@ -17912,29 +18599,41 @@ func (obj *pgxcockroachImpl) Paged_PendingSerialQueue(ctx context.Context, } obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, next, err = func() (rows []*PendingSerialQueue, next *Paged_PendingSerialQueue_Continuation, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, nil, err + } + defer __rows.Close() - var __continuation Paged_PendingSerialQueue_Continuation - __continuation._set = true + var __continuation Paged_PendingSerialQueue_Continuation + __continuation._set = true - for __rows.Next() { - pending_serial_queue := &PendingSerialQueue{} - err = __rows.Scan(&pending_serial_queue.StorageNodeId, &pending_serial_queue.BucketId, &pending_serial_queue.SerialNumber, &pending_serial_queue.Action, &pending_serial_queue.Settled, &pending_serial_queue.ExpiresAt, &__continuation._value_storage_node_id, &__continuation._value_bucket_id, &__continuation._value_serial_number) + for __rows.Next() { + pending_serial_queue := &PendingSerialQueue{} + err = __rows.Scan(&pending_serial_queue.StorageNodeId, &pending_serial_queue.BucketId, &pending_serial_queue.SerialNumber, &pending_serial_queue.Action, &pending_serial_queue.Settled, &pending_serial_queue.ExpiresAt, &__continuation._value_storage_node_id, &__continuation._value_bucket_id, &__continuation._value_serial_number) + if err != nil { + return nil, nil, err + } + rows = append(rows, pending_serial_queue) + next = &__continuation + } + + if err := __rows.Err(); err != nil { + return nil, nil, err + } + + return rows, next, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, nil, obj.makeErr(err) } - rows = append(rows, pending_serial_queue) - next = &__continuation + return rows, next, nil } - if err := __rows.Err(); err != nil { - return nil, nil, obj.makeErr(err) - } - - return rows, next, nil } @@ -18027,27 +18726,38 @@ func (obj *pgxcockroachImpl) First_BucketStorageTally_By_ProjectId_OrderBy_Desc_ var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + bucket_storage_tally, err := func() (bucket_storage_tally *BucketStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, nil + } + + bucket_storage_tally = &BucketStorageTally{} + err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + if err != nil { + return nil, err + } + + return bucket_storage_tally, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - return nil, nil + return bucket_storage_tally, nil } - bucket_storage_tally = &BucketStorageTally{} - err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) - if err != nil { - return nil, obj.makeErr(err) - } - - return bucket_storage_tally, nil - } func (obj *pgxcockroachImpl) All_BucketStorageTally(ctx context.Context) ( @@ -18061,24 +18771,35 @@ func (obj *pgxcockroachImpl) All_BucketStorageTally(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*BucketStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_storage_tally := &BucketStorageTally{} - err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + for __rows.Next() { + bucket_storage_tally := &BucketStorageTally{} + err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + if err != nil { + return nil, err + } + rows = append(rows, bucket_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18098,24 +18819,35 @@ func (obj *pgxcockroachImpl) All_BucketStorageTally_By_ProjectId_And_BucketName_ var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*BucketStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_storage_tally := &BucketStorageTally{} - err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + for __rows.Next() { + bucket_storage_tally := &BucketStorageTally{} + err = __rows.Scan(&bucket_storage_tally.BucketName, &bucket_storage_tally.ProjectId, &bucket_storage_tally.IntervalStart, &bucket_storage_tally.Inline, &bucket_storage_tally.Remote, &bucket_storage_tally.RemoteSegmentsCount, &bucket_storage_tally.InlineSegmentsCount, &bucket_storage_tally.ObjectCount, &bucket_storage_tally.MetadataSize) + if err != nil { + return nil, err + } + rows = append(rows, bucket_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18133,24 +18865,35 @@ func (obj *pgxcockroachImpl) All_StoragenodeBandwidthRollup_By_StoragenodeId_And var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*StoragenodeBandwidthRollup, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} - err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled) + for __rows.Next() { + storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} + err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled) + if err != nil { + return nil, err + } + rows = append(rows, storagenode_bandwidth_rollup) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, storagenode_bandwidth_rollup) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18178,29 +18921,41 @@ func (obj *pgxcockroachImpl) Paged_StoragenodeBandwidthRollup_By_StoragenodeId_A } obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, next, err = func() (rows []*StoragenodeBandwidthRollup, next *Paged_StoragenodeBandwidthRollup_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, nil, err + } + defer __rows.Close() - var __continuation Paged_StoragenodeBandwidthRollup_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation - __continuation._set = true + var __continuation Paged_StoragenodeBandwidthRollup_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation + __continuation._set = true - for __rows.Next() { - storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} - err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + for __rows.Next() { + storagenode_bandwidth_rollup := &StoragenodeBandwidthRollup{} + err = __rows.Scan(&storagenode_bandwidth_rollup.StoragenodeId, &storagenode_bandwidth_rollup.IntervalStart, &storagenode_bandwidth_rollup.IntervalSeconds, &storagenode_bandwidth_rollup.Action, &storagenode_bandwidth_rollup.Allocated, &storagenode_bandwidth_rollup.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + if err != nil { + return nil, nil, err + } + rows = append(rows, storagenode_bandwidth_rollup) + next = &__continuation + } + + if err := __rows.Err(); err != nil { + return nil, nil, err + } + + return rows, next, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, nil, obj.makeErr(err) } - rows = append(rows, storagenode_bandwidth_rollup) - next = &__continuation + return rows, next, nil } - if err := __rows.Err(); err != nil { - return nil, nil, obj.makeErr(err) - } - - return rows, next, nil } @@ -18228,29 +18983,41 @@ func (obj *pgxcockroachImpl) Paged_StoragenodeBandwidthRollupPhase2_By_Storageno } obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, next, err = func() (rows []*StoragenodeBandwidthRollupPhase2, next *Paged_StoragenodeBandwidthRollupPhase2_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, nil, err + } + defer __rows.Close() - var __continuation Paged_StoragenodeBandwidthRollupPhase2_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation - __continuation._set = true + var __continuation Paged_StoragenodeBandwidthRollupPhase2_By_StoragenodeId_And_IntervalStart_GreaterOrEqual_Continuation + __continuation._set = true - for __rows.Next() { - storagenode_bandwidth_rollup_phase2 := &StoragenodeBandwidthRollupPhase2{} - err = __rows.Scan(&storagenode_bandwidth_rollup_phase2.StoragenodeId, &storagenode_bandwidth_rollup_phase2.IntervalStart, &storagenode_bandwidth_rollup_phase2.IntervalSeconds, &storagenode_bandwidth_rollup_phase2.Action, &storagenode_bandwidth_rollup_phase2.Allocated, &storagenode_bandwidth_rollup_phase2.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + for __rows.Next() { + storagenode_bandwidth_rollup_phase2 := &StoragenodeBandwidthRollupPhase2{} + err = __rows.Scan(&storagenode_bandwidth_rollup_phase2.StoragenodeId, &storagenode_bandwidth_rollup_phase2.IntervalStart, &storagenode_bandwidth_rollup_phase2.IntervalSeconds, &storagenode_bandwidth_rollup_phase2.Action, &storagenode_bandwidth_rollup_phase2.Allocated, &storagenode_bandwidth_rollup_phase2.Settled, &__continuation._value_storagenode_id, &__continuation._value_interval_start, &__continuation._value_action) + if err != nil { + return nil, nil, err + } + rows = append(rows, storagenode_bandwidth_rollup_phase2) + next = &__continuation + } + + if err := __rows.Err(); err != nil { + return nil, nil, err + } + + return rows, next, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, nil, obj.makeErr(err) } - rows = append(rows, storagenode_bandwidth_rollup_phase2) - next = &__continuation + return rows, next, nil } - if err := __rows.Err(); err != nil { - return nil, nil, obj.makeErr(err) - } - - return rows, next, nil } @@ -18265,24 +19032,35 @@ func (obj *pgxcockroachImpl) All_StoragenodeStorageTally(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*StoragenodeStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - storagenode_storage_tally := &StoragenodeStorageTally{} - err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + for __rows.Next() { + storagenode_storage_tally := &StoragenodeStorageTally{} + err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + if err != nil { + return nil, err + } + rows = append(rows, storagenode_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, storagenode_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18299,24 +19077,35 @@ func (obj *pgxcockroachImpl) All_StoragenodeStorageTally_By_IntervalEndTime_Grea var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*StoragenodeStorageTally, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - storagenode_storage_tally := &StoragenodeStorageTally{} - err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + for __rows.Next() { + storagenode_storage_tally := &StoragenodeStorageTally{} + err = __rows.Scan(&storagenode_storage_tally.NodeId, &storagenode_storage_tally.IntervalEndTime, &storagenode_storage_tally.DataTotal) + if err != nil { + return nil, err + } + rows = append(rows, storagenode_storage_tally) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, storagenode_storage_tally) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18490,24 +19279,35 @@ func (obj *pgxcockroachImpl) All_Offer_OrderBy_Asc_Id(ctx context.Context) ( var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Offer, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - offer := &Offer{} - err = __rows.Scan(&offer.Id, &offer.Name, &offer.Description, &offer.AwardCreditInCents, &offer.InviteeCreditInCents, &offer.AwardCreditDurationDays, &offer.InviteeCreditDurationDays, &offer.RedeemableCap, &offer.ExpiresAt, &offer.CreatedAt, &offer.Status, &offer.Type) + for __rows.Next() { + offer := &Offer{} + err = __rows.Scan(&offer.Id, &offer.Name, &offer.Description, &offer.AwardCreditInCents, &offer.InviteeCreditInCents, &offer.AwardCreditDurationDays, &offer.InviteeCreditDurationDays, &offer.RedeemableCap, &offer.ExpiresAt, &offer.CreatedAt, &offer.Status, &offer.Type) + if err != nil { + return nil, err + } + rows = append(rows, offer) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, offer) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18525,24 +19325,35 @@ func (obj *pgxcockroachImpl) All_UserCredit_By_UserId_And_ExpiresAt_Greater_And_ var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*UserCredit, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - user_credit := &UserCredit{} - err = __rows.Scan(&user_credit.Id, &user_credit.UserId, &user_credit.OfferId, &user_credit.ReferredBy, &user_credit.Type, &user_credit.CreditsEarnedInCents, &user_credit.CreditsUsedInCents, &user_credit.ExpiresAt, &user_credit.CreatedAt) + for __rows.Next() { + user_credit := &UserCredit{} + err = __rows.Scan(&user_credit.Id, &user_credit.UserId, &user_credit.OfferId, &user_credit.ReferredBy, &user_credit.Type, &user_credit.CreditsEarnedInCents, &user_credit.CreditsUsedInCents, &user_credit.ExpiresAt, &user_credit.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, user_credit) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, user_credit) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18636,24 +19447,36 @@ func (obj *pgxcockroachImpl) Limited_BucketMetainfo_By_ProjectId_And_Name_Greate var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*BucketMetainfo, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_metainfo := &BucketMetainfo{} - err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + for __rows.Next() { + bucket_metainfo := &BucketMetainfo{} + err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + if err != nil { + return nil, err + } + rows = append(rows, bucket_metainfo) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_metainfo) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18674,24 +19497,36 @@ func (obj *pgxcockroachImpl) Limited_BucketMetainfo_By_ProjectId_And_Name_Greate var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*BucketMetainfo, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - bucket_metainfo := &BucketMetainfo{} - err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + for __rows.Next() { + bucket_metainfo := &BucketMetainfo{} + err = __rows.Scan(&bucket_metainfo.Id, &bucket_metainfo.ProjectId, &bucket_metainfo.Name, &bucket_metainfo.PartnerId, &bucket_metainfo.PathCipher, &bucket_metainfo.CreatedAt, &bucket_metainfo.DefaultSegmentSize, &bucket_metainfo.DefaultEncryptionCipherSuite, &bucket_metainfo.DefaultEncryptionBlockSize, &bucket_metainfo.DefaultRedundancyAlgorithm, &bucket_metainfo.DefaultRedundancyShareSize, &bucket_metainfo.DefaultRedundancyRequiredShares, &bucket_metainfo.DefaultRedundancyRepairShares, &bucket_metainfo.DefaultRedundancyOptimalShares, &bucket_metainfo.DefaultRedundancyTotalShares) + if err != nil { + return nil, err + } + rows = append(rows, bucket_metainfo) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, bucket_metainfo) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18778,24 +19613,35 @@ func (obj *pgxcockroachImpl) All_NodesOfflineTime_By_NodeId_And_TrackedAt_Greate var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*NodesOfflineTime, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - nodes_offline_time := &NodesOfflineTime{} - err = __rows.Scan(&nodes_offline_time.NodeId, &nodes_offline_time.TrackedAt, &nodes_offline_time.Seconds) + for __rows.Next() { + nodes_offline_time := &NodesOfflineTime{} + err = __rows.Scan(&nodes_offline_time.NodeId, &nodes_offline_time.TrackedAt, &nodes_offline_time.Seconds) + if err != nil { + return nil, err + } + rows = append(rows, nodes_offline_time) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, nodes_offline_time) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18837,24 +19683,36 @@ func (obj *pgxcockroachImpl) Limited_StripeCustomer_By_CreatedAt_LessOrEqual_Ord var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*StripeCustomer, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - stripe_customer := &StripeCustomer{} - err = __rows.Scan(&stripe_customer.UserId, &stripe_customer.CustomerId, &stripe_customer.CreatedAt) + for __rows.Next() { + stripe_customer := &StripeCustomer{} + err = __rows.Scan(&stripe_customer.UserId, &stripe_customer.CustomerId, &stripe_customer.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, stripe_customer) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, stripe_customer) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18871,24 +19729,35 @@ func (obj *pgxcockroachImpl) All_CoinpaymentsTransaction_By_UserId_OrderBy_Desc_ var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*CoinpaymentsTransaction, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coinpayments_transaction := &CoinpaymentsTransaction{} - err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + for __rows.Next() { + coinpayments_transaction := &CoinpaymentsTransaction{} + err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coinpayments_transaction) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coinpayments_transaction) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18909,24 +19778,36 @@ func (obj *pgxcockroachImpl) Limited_CoinpaymentsTransaction_By_CreatedAt_LessOr var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*CoinpaymentsTransaction, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coinpayments_transaction := &CoinpaymentsTransaction{} - err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + for __rows.Next() { + coinpayments_transaction := &CoinpaymentsTransaction{} + err = __rows.Scan(&coinpayments_transaction.Id, &coinpayments_transaction.UserId, &coinpayments_transaction.Address, &coinpayments_transaction.Amount, &coinpayments_transaction.Received, &coinpayments_transaction.Status, &coinpayments_transaction.Key, &coinpayments_transaction.Timeout, &coinpayments_transaction.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coinpayments_transaction) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coinpayments_transaction) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -18972,24 +19853,36 @@ func (obj *pgxcockroachImpl) Limited_StripecoinpaymentsInvoiceProjectRecord_By_P var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*StripecoinpaymentsInvoiceProjectRecord, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - stripecoinpayments_invoice_project_record := &StripecoinpaymentsInvoiceProjectRecord{} - err = __rows.Scan(&stripecoinpayments_invoice_project_record.Id, &stripecoinpayments_invoice_project_record.ProjectId, &stripecoinpayments_invoice_project_record.Storage, &stripecoinpayments_invoice_project_record.Egress, &stripecoinpayments_invoice_project_record.Objects, &stripecoinpayments_invoice_project_record.PeriodStart, &stripecoinpayments_invoice_project_record.PeriodEnd, &stripecoinpayments_invoice_project_record.State, &stripecoinpayments_invoice_project_record.CreatedAt) + for __rows.Next() { + stripecoinpayments_invoice_project_record := &StripecoinpaymentsInvoiceProjectRecord{} + err = __rows.Scan(&stripecoinpayments_invoice_project_record.Id, &stripecoinpayments_invoice_project_record.ProjectId, &stripecoinpayments_invoice_project_record.Storage, &stripecoinpayments_invoice_project_record.Egress, &stripecoinpayments_invoice_project_record.Objects, &stripecoinpayments_invoice_project_record.PeriodStart, &stripecoinpayments_invoice_project_record.PeriodEnd, &stripecoinpayments_invoice_project_record.State, &stripecoinpayments_invoice_project_record.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, stripecoinpayments_invoice_project_record) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, stripecoinpayments_invoice_project_record) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -19050,24 +19943,35 @@ func (obj *pgxcockroachImpl) All_Coupon_By_UserId_OrderBy_Desc_CreatedAt(ctx con var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -19085,24 +19989,35 @@ func (obj *pgxcockroachImpl) All_Coupon_By_UserId_And_Status_OrderBy_Desc_Create var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -19119,24 +20034,35 @@ func (obj *pgxcockroachImpl) All_Coupon_By_Status_OrderBy_Desc_CreatedAt(ctx con var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -19157,24 +20083,36 @@ func (obj *pgxcockroachImpl) Limited_Coupon_By_CreatedAt_LessOrEqual_And_Status_ var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*Coupon, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon := &Coupon{} - err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + for __rows.Next() { + coupon := &Coupon{} + err = __rows.Scan(&coupon.Id, &coupon.UserId, &coupon.Amount, &coupon.Description, &coupon.Type, &coupon.Status, &coupon.Duration, &coupon.CreatedAt) + if err != nil { + return nil, err + } + rows = append(rows, coupon) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } @@ -19194,24 +20132,36 @@ func (obj *pgxcockroachImpl) Limited_CouponUsage_By_Period_And_Status_Equal_Numb var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows []*CouponUsage, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - coupon_usage := &CouponUsage{} - err = __rows.Scan(&coupon_usage.CouponId, &coupon_usage.Amount, &coupon_usage.Status, &coupon_usage.Period) + for __rows.Next() { + coupon_usage := &CouponUsage{} + err = __rows.Scan(&coupon_usage.CouponId, &coupon_usage.Amount, &coupon_usage.Status, &coupon_usage.Period) + if err != nil { + return nil, err + } + rows = append(rows, coupon_usage) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() if err != nil { + if obj.shouldRetry(err) { + continue + } return nil, obj.makeErr(err) } - rows = append(rows, coupon_usage) + return rows, nil } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil } diff --git a/satellite/satellitedb/dbx/templates/golang.get-all.tmpl b/satellite/satellitedb/dbx/templates/golang.get-all.tmpl index 017114d92..3d60372d1 100644 --- a/satellite/satellitedb/dbx/templates/golang.get-all.tmpl +++ b/satellite/satellitedb/dbx/templates/golang.get-all.tmpl @@ -17,22 +17,33 @@ All_{{ .Suffix }}({{ ctxarg .Args }}) var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err = func() (rows {{ sliceof .Row }}, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - {{ initnew .Row }} - err = __rows.Scan({{ addrof (flatten .Row) }}) - if err != nil { - return nil, obj.makeErr(err) - } - rows = append(rows, {{ arg .Row }}) - } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil + for __rows.Next() { + {{ initnew .Row }} + err = __rows.Scan({{ addrof (flatten .Row) }}) + if err != nil { + return nil, err + } + rows = append(rows, {{ arg .Row }}) + } + if err := __rows.Err(); err != nil { + return nil, err + } + return rows, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + return nil, obj.makeErr(err) + } + return rows, nil + } {{ end -}} diff --git a/satellite/satellitedb/dbx/templates/golang.get-first.tmpl b/satellite/satellitedb/dbx/templates/golang.get-first.tmpl index f032c1fb3..53db80af6 100644 --- a/satellite/satellitedb/dbx/templates/golang.get-first.tmpl +++ b/satellite/satellitedb/dbx/templates/golang.get-first.tmpl @@ -17,24 +17,35 @@ First_{{ .Suffix }}({{ ctxarg .Args }}) var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + {{ arg .Row }}, err := func() ({{ param .Row }}, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return nil, nil - } + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, nil + } - {{ init .Row }} - err = __rows.Scan({{ addrof (flatten .Row) }}) - if err != nil { - return nil, obj.makeErr(err) - } + {{ init .Row }} + err = __rows.Scan({{ addrof (flatten .Row) }}) + if err != nil { + return nil, err + } - return {{ arg .Row }}, nil + return {{ arg .Row }}, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + return nil, obj.makeErr(err) + } + return {{ arg .Row }}, nil + } {{ end -}} diff --git a/satellite/satellitedb/dbx/templates/golang.get-limitoffset.tmpl b/satellite/satellitedb/dbx/templates/golang.get-limitoffset.tmpl index 49bd5555b..ceb893f7b 100644 --- a/satellite/satellitedb/dbx/templates/golang.get-limitoffset.tmpl +++ b/satellite/satellitedb/dbx/templates/golang.get-limitoffset.tmpl @@ -20,22 +20,34 @@ Limited_{{ .Suffix }}({{ ctxarg .Args }}, limit, offset) var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, err := func() (rows {{ sliceof .Row }}, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - for __rows.Next() { - {{ initnew .Row }} - err = __rows.Scan({{ addrof (flatten .Row) }}) - if err != nil { - return nil, obj.makeErr(err) - } - rows = append(rows, {{ arg .Row }}) - } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return rows, nil + for __rows.Next() { + {{ initnew .Row }} + err = __rows.Scan({{ addrof (flatten .Row) }}) + if err != nil { + return nil, err + } + rows = append(rows, {{ arg .Row }}) + } + err = __rows.Err() + if err != nil { + return nil, err + } + return rows, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + return nil, obj.makeErr(err) + } + return rows, nil + } {{ end -}} diff --git a/satellite/satellitedb/dbx/templates/golang.get-one-all.tmpl b/satellite/satellitedb/dbx/templates/golang.get-one-all.tmpl index 69c65e9ec..d7d12519a 100644 --- a/satellite/satellitedb/dbx/templates/golang.get-one-all.tmpl +++ b/satellite/satellitedb/dbx/templates/golang.get-one-all.tmpl @@ -17,32 +17,46 @@ Get_{{ .Suffix }}({{ ctxarg .Args }}) var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + {{ arg .Row }}, err = func() ({{ param .Row }}, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return nil, makeErr(sql.ErrNoRows) - } + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, sql.ErrNoRows + } - {{ init .Row }} - err = __rows.Scan({{ addrof (flatten .Row) }}) - if err != nil { - return nil, obj.makeErr(err) - } + {{ init .Row }} + err = __rows.Scan({{ addrof (flatten .Row) }}) + if err != nil { + return nil, err + } - if __rows.Next() { - return nil, tooManyRows({{ printf "%q" .Suffix }}) - } + if __rows.Next() { + return nil, errTooManyRows + } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } + if err := __rows.Err(); err != nil { + return nil, err + } - return {{ arg .Row }}, nil + return {{ arg .Row }}, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows({{ printf "%q" .Suffix }}) + } + return nil, obj.makeErr(err) + } + return {{ arg .Row }}, nil + } {{ end -}} diff --git a/satellite/satellitedb/dbx/templates/golang.get-paged.tmpl b/satellite/satellitedb/dbx/templates/golang.get-paged.tmpl index 35958c334..25b0a1447 100644 --- a/satellite/satellitedb/dbx/templates/golang.get-paged.tmpl +++ b/satellite/satellitedb/dbx/templates/golang.get-paged.tmpl @@ -26,27 +26,39 @@ Paged_{{ .Suffix }}({{ ctxarg .Args }}, limit, start) } obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, nil, obj.makeErr(err) - } - defer __rows.Close() + for { + rows, next, err = func() (rows {{ sliceof .Row }}, next *{{ .Continuation.Type }}, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, nil, err + } + defer __rows.Close() - {{ declare .Continuation }} - {{ .Continuation.Name }}._set = true + {{ declare .Continuation }} + {{ .Continuation.Name }}._set = true - for __rows.Next() { - {{ initnew .Row }} - err = __rows.Scan({{ .Row | flatten | addrof | comma }}{{ .Continuation | flatten | slice 0 -1 | addrof }}) - if err != nil { - return nil, nil, obj.makeErr(err) - } - rows = append(rows, {{ arg .Row }}) - next = {{ addrof .Continuation }} - } - if err := __rows.Err(); err != nil { - return nil, nil, obj.makeErr(err) - } + for __rows.Next() { + {{ initnew .Row }} + err = __rows.Scan({{ .Row | flatten | addrof | comma }}{{ .Continuation | flatten | slice 0 -1 | addrof }}) + if err != nil { + return nil, nil, err + } + rows = append(rows, {{ arg .Row }}) + next = {{ addrof .Continuation }} + } - return rows, next, nil + if err := __rows.Err(); err != nil { + return nil, nil, err + } + + return rows, next, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + return nil, nil, obj.makeErr(err) + } + return rows, next, nil + } {{ end -}} diff --git a/satellite/satellitedb/dbx/templates/golang.get-scalar-all.tmpl b/satellite/satellitedb/dbx/templates/golang.get-scalar-all.tmpl index b0e83609c..b8ab62130 100644 --- a/satellite/satellitedb/dbx/templates/golang.get-scalar-all.tmpl +++ b/satellite/satellitedb/dbx/templates/golang.get-scalar-all.tmpl @@ -17,32 +17,46 @@ Find_{{ .Suffix }}({{ ctxarg .Args }}) var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt) obj.logStmt(__stmt, __values...) - __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) - if err != nil { - return nil, obj.makeErr(err) - } - defer __rows.Close() + for { + {{ arg .Row }}, err = func() ({{ param .Row }}, err error) { + __rows, err := obj.driver.QueryContext(ctx, __stmt, __values...) + if err != nil { + return nil, err + } + defer __rows.Close() - if !__rows.Next() { - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } - return nil, nil - } + if !__rows.Next() { + if err := __rows.Err(); err != nil { + return nil, err + } + return nil, nil + } - {{ init .Row }} - err = __rows.Scan({{ addrof (flatten .Row) }}) - if err != nil { - return nil, obj.makeErr(err) - } + {{ init .Row }} + err = __rows.Scan({{ addrof (flatten .Row) }}) + if err != nil { + return nil, err + } - if __rows.Next() { - return nil, tooManyRows({{ printf "%q" .Suffix }}) - } + if __rows.Next() { + return nil, errTooManyRows + } - if err := __rows.Err(); err != nil { - return nil, obj.makeErr(err) - } + if err := __rows.Err(); err != nil { + return nil, err + } - return {{ arg .Row }}, nil + return {{ arg .Row }}, nil + }() + if err != nil { + if obj.shouldRetry(err) { + continue + } + if err == errTooManyRows { + return nil, tooManyRows({{ printf "%q" .Suffix }}) + } + return nil, obj.makeErr(err) + } + return {{ arg .Row }}, nil + } {{ end -}}