// Code generated by BobGen psql v0.42.5. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" "fmt" "io" "time" "github.com/Gleipnir-Technology/bob" "github.com/Gleipnir-Technology/bob/dialect/psql" "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" "github.com/Gleipnir-Technology/bob/dialect/psql/dm" "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" ) // FileuploadCSV is an object representing the database table. type FileuploadCSV struct { Committed null.Val[time.Time] `db:"committed" ` FileID int32 `db:"file_id,pk" ` Rowcount int32 `db:"rowcount" ` Type enums.FileuploadCsvtype `db:"type_" ` R fileuploadCSVR `db:"-" ` C fileuploadCSVC `db:"-" ` } // FileuploadCSVSlice is an alias for a slice of pointers to FileuploadCSV. // This should almost always be used instead of []*FileuploadCSV. type FileuploadCSVSlice []*FileuploadCSV // FileuploadCSVS contains methods to work with the csv table var FileuploadCSVS = psql.NewTablex[*FileuploadCSV, FileuploadCSVSlice, *FileuploadCSVSetter]("fileupload", "csv", buildFileuploadCSVColumns("fileupload.csv")) // FileuploadCSVSQuery is a query on the csv table type FileuploadCSVSQuery = *psql.ViewQuery[*FileuploadCSV, FileuploadCSVSlice] // fileuploadCSVR is where relationships are stored. type fileuploadCSVR struct { File *FileuploadFile // fileupload.csv.csv_file_id_fkey CSVFileErrorCSVS FileuploadErrorCSVSlice // fileupload.error_csv.error_csv_csv_file_id_fkey CSVFileFlyoverAerialServices FileuploadFlyoverAerialServiceSlice // fileupload.flyover_aerial_service.flyover_aerial_service_csv_file_fkey CSVFilePools FileuploadPoolSlice // fileupload.pool.pool_csv_file_fkey } func buildFileuploadCSVColumns(alias string) fileuploadCSVColumns { return fileuploadCSVColumns{ ColumnsExpr: expr.NewColumnsExpr( "committed", "file_id", "rowcount", "type_", ).WithParent("fileupload.csv"), tableAlias: alias, Committed: psql.Quote(alias, "committed"), FileID: psql.Quote(alias, "file_id"), Rowcount: psql.Quote(alias, "rowcount"), Type: psql.Quote(alias, "type_"), } } type fileuploadCSVColumns struct { expr.ColumnsExpr tableAlias string Committed psql.Expression FileID psql.Expression Rowcount psql.Expression Type psql.Expression } func (c fileuploadCSVColumns) Alias() string { return c.tableAlias } func (fileuploadCSVColumns) AliasedAs(alias string) fileuploadCSVColumns { return buildFileuploadCSVColumns(alias) } // FileuploadCSVSetter is used for insert/upsert/update operations // All values are optional, and do not have to be set // Generated columns are not included type FileuploadCSVSetter struct { Committed omitnull.Val[time.Time] `db:"committed" ` FileID omit.Val[int32] `db:"file_id,pk" ` Rowcount omit.Val[int32] `db:"rowcount" ` Type omit.Val[enums.FileuploadCsvtype] `db:"type_" ` } func (s FileuploadCSVSetter) SetColumns() []string { vals := make([]string, 0, 4) if !s.Committed.IsUnset() { vals = append(vals, "committed") } if s.FileID.IsValue() { vals = append(vals, "file_id") } if s.Rowcount.IsValue() { vals = append(vals, "rowcount") } if s.Type.IsValue() { vals = append(vals, "type_") } return vals } func (s FileuploadCSVSetter) Overwrite(t *FileuploadCSV) { if !s.Committed.IsUnset() { t.Committed = s.Committed.MustGetNull() } if s.FileID.IsValue() { t.FileID = s.FileID.MustGet() } if s.Rowcount.IsValue() { t.Rowcount = s.Rowcount.MustGet() } if s.Type.IsValue() { t.Type = s.Type.MustGet() } } func (s *FileuploadCSVSetter) Apply(q *dialect.InsertQuery) { q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { return FileuploadCSVS.BeforeInsertHooks.RunHooks(ctx, exec, s) }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 4) if !s.Committed.IsUnset() { vals[0] = psql.Arg(s.Committed.MustGetNull()) } else { vals[0] = psql.Raw("DEFAULT") } if s.FileID.IsValue() { vals[1] = psql.Arg(s.FileID.MustGet()) } else { vals[1] = psql.Raw("DEFAULT") } if s.Rowcount.IsValue() { vals[2] = psql.Arg(s.Rowcount.MustGet()) } else { vals[2] = psql.Raw("DEFAULT") } if s.Type.IsValue() { vals[3] = psql.Arg(s.Type.MustGet()) } else { vals[3] = psql.Raw("DEFAULT") } return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } func (s FileuploadCSVSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { return um.Set(s.Expressions()...) } func (s FileuploadCSVSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 4) if !s.Committed.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "committed")...), psql.Arg(s.Committed), }}) } if s.FileID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "file_id")...), psql.Arg(s.FileID), }}) } if s.Rowcount.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "rowcount")...), psql.Arg(s.Rowcount), }}) } if s.Type.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "type_")...), psql.Arg(s.Type), }}) } return exprs } // FindFileuploadCSV retrieves a single record by primary key // If cols is empty Find will return all columns. func FindFileuploadCSV(ctx context.Context, exec bob.Executor, FileIDPK int32, cols ...string) (*FileuploadCSV, error) { if len(cols) == 0 { return FileuploadCSVS.Query( sm.Where(FileuploadCSVS.Columns.FileID.EQ(psql.Arg(FileIDPK))), ).One(ctx, exec) } return FileuploadCSVS.Query( sm.Where(FileuploadCSVS.Columns.FileID.EQ(psql.Arg(FileIDPK))), sm.Columns(FileuploadCSVS.Columns.Only(cols...)), ).One(ctx, exec) } // FileuploadCSVExists checks the presence of a single record by primary key func FileuploadCSVExists(ctx context.Context, exec bob.Executor, FileIDPK int32) (bool, error) { return FileuploadCSVS.Query( sm.Where(FileuploadCSVS.Columns.FileID.EQ(psql.Arg(FileIDPK))), ).Exists(ctx, exec) } // AfterQueryHook is called after FileuploadCSV is retrieved from the database func (o *FileuploadCSV) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { var err error switch queryType { case bob.QueryTypeSelect: ctx, err = FileuploadCSVS.AfterSelectHooks.RunHooks(ctx, exec, FileuploadCSVSlice{o}) case bob.QueryTypeInsert: ctx, err = FileuploadCSVS.AfterInsertHooks.RunHooks(ctx, exec, FileuploadCSVSlice{o}) case bob.QueryTypeUpdate: ctx, err = FileuploadCSVS.AfterUpdateHooks.RunHooks(ctx, exec, FileuploadCSVSlice{o}) case bob.QueryTypeDelete: ctx, err = FileuploadCSVS.AfterDeleteHooks.RunHooks(ctx, exec, FileuploadCSVSlice{o}) } return err } // primaryKeyVals returns the primary key values of the FileuploadCSV func (o *FileuploadCSV) primaryKeyVals() bob.Expression { return psql.Arg(o.FileID) } func (o *FileuploadCSV) pkEQ() dialect.Expression { return psql.Quote("fileupload.csv", "file_id").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { return o.primaryKeyVals().WriteSQL(ctx, w, d, start) })) } // Update uses an executor to update the FileuploadCSV func (o *FileuploadCSV) Update(ctx context.Context, exec bob.Executor, s *FileuploadCSVSetter) error { v, err := FileuploadCSVS.Update(s.UpdateMod(), um.Where(o.pkEQ())).One(ctx, exec) if err != nil { return err } o.R = v.R *o = *v return nil } // Delete deletes a single FileuploadCSV record with an executor func (o *FileuploadCSV) Delete(ctx context.Context, exec bob.Executor) error { _, err := FileuploadCSVS.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) return err } // Reload refreshes the FileuploadCSV using the executor func (o *FileuploadCSV) Reload(ctx context.Context, exec bob.Executor) error { o2, err := FileuploadCSVS.Query( sm.Where(FileuploadCSVS.Columns.FileID.EQ(psql.Arg(o.FileID))), ).One(ctx, exec) if err != nil { return err } o2.R = o.R *o = *o2 return nil } // AfterQueryHook is called after FileuploadCSVSlice is retrieved from the database func (o FileuploadCSVSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { var err error switch queryType { case bob.QueryTypeSelect: ctx, err = FileuploadCSVS.AfterSelectHooks.RunHooks(ctx, exec, o) case bob.QueryTypeInsert: ctx, err = FileuploadCSVS.AfterInsertHooks.RunHooks(ctx, exec, o) case bob.QueryTypeUpdate: ctx, err = FileuploadCSVS.AfterUpdateHooks.RunHooks(ctx, exec, o) case bob.QueryTypeDelete: ctx, err = FileuploadCSVS.AfterDeleteHooks.RunHooks(ctx, exec, o) } return err } func (o FileuploadCSVSlice) pkIN() dialect.Expression { if len(o) == 0 { return psql.Raw("NULL") } return psql.Quote("fileupload.csv", "file_id").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { pkPairs := make([]bob.Expression, len(o)) for i, row := range o { pkPairs[i] = row.primaryKeyVals() } return bob.ExpressSlice(ctx, w, d, start, pkPairs, "", ", ", "") })) } // copyMatchingRows finds models in the given slice that have the same primary key // then it first copies the existing relationships from the old model to the new model // and then replaces the old model in the slice with the new model func (o FileuploadCSVSlice) copyMatchingRows(from ...*FileuploadCSV) { for i, old := range o { for _, new := range from { if new.FileID != old.FileID { continue } new.R = old.R o[i] = new break } } } // UpdateMod modifies an update query with "WHERE primary_key IN (o...)" func (o FileuploadCSVSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery] { return bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) { q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { return FileuploadCSVS.BeforeUpdateHooks.RunHooks(ctx, exec, o) }) q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { var err error switch retrieved := retrieved.(type) { case *FileuploadCSV: o.copyMatchingRows(retrieved) case []*FileuploadCSV: o.copyMatchingRows(retrieved...) case FileuploadCSVSlice: o.copyMatchingRows(retrieved...) default: // If the retrieved value is not a FileuploadCSV or a slice of FileuploadCSV // then run the AfterUpdateHooks on the slice _, err = FileuploadCSVS.AfterUpdateHooks.RunHooks(ctx, exec, o) } return err })) q.AppendWhere(o.pkIN()) }) } // DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" func (o FileuploadCSVSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery] { return bob.ModFunc[*dialect.DeleteQuery](func(q *dialect.DeleteQuery) { q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { return FileuploadCSVS.BeforeDeleteHooks.RunHooks(ctx, exec, o) }) q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { var err error switch retrieved := retrieved.(type) { case *FileuploadCSV: o.copyMatchingRows(retrieved) case []*FileuploadCSV: o.copyMatchingRows(retrieved...) case FileuploadCSVSlice: o.copyMatchingRows(retrieved...) default: // If the retrieved value is not a FileuploadCSV or a slice of FileuploadCSV // then run the AfterDeleteHooks on the slice _, err = FileuploadCSVS.AfterDeleteHooks.RunHooks(ctx, exec, o) } return err })) q.AppendWhere(o.pkIN()) }) } func (o FileuploadCSVSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FileuploadCSVSetter) error { if len(o) == 0 { return nil } _, err := FileuploadCSVS.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) return err } func (o FileuploadCSVSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { if len(o) == 0 { return nil } _, err := FileuploadCSVS.Delete(o.DeleteMod()).Exec(ctx, exec) return err } func (o FileuploadCSVSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { if len(o) == 0 { return nil } o2, err := FileuploadCSVS.Query(sm.Where(o.pkIN())).All(ctx, exec) if err != nil { return err } o.copyMatchingRows(o2...) return nil } // File starts a query for related objects on fileupload.file func (o *FileuploadCSV) File(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadFilesQuery { return FileuploadFiles.Query(append(mods, sm.Where(FileuploadFiles.Columns.ID.EQ(psql.Arg(o.FileID))), )...) } func (os FileuploadCSVSlice) File(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadFilesQuery { pkFileID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue } pkFileID = append(pkFileID, o.FileID) } PKArgExpr := psql.Select(sm.Columns( psql.F("unnest", psql.Cast(psql.Arg(pkFileID), "integer[]")), )) return FileuploadFiles.Query(append(mods, sm.Where(psql.Group(FileuploadFiles.Columns.ID).OP("IN", PKArgExpr)), )...) } // CSVFileErrorCSVS starts a query for related objects on fileupload.error_csv func (o *FileuploadCSV) CSVFileErrorCSVS(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadErrorCSVSQuery { return FileuploadErrorCSVS.Query(append(mods, sm.Where(FileuploadErrorCSVS.Columns.CSVFileID.EQ(psql.Arg(o.FileID))), )...) } func (os FileuploadCSVSlice) CSVFileErrorCSVS(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadErrorCSVSQuery { pkFileID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue } pkFileID = append(pkFileID, o.FileID) } PKArgExpr := psql.Select(sm.Columns( psql.F("unnest", psql.Cast(psql.Arg(pkFileID), "integer[]")), )) return FileuploadErrorCSVS.Query(append(mods, sm.Where(psql.Group(FileuploadErrorCSVS.Columns.CSVFileID).OP("IN", PKArgExpr)), )...) } // CSVFileFlyoverAerialServices starts a query for related objects on fileupload.flyover_aerial_service func (o *FileuploadCSV) CSVFileFlyoverAerialServices(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadFlyoverAerialServicesQuery { return FileuploadFlyoverAerialServices.Query(append(mods, sm.Where(FileuploadFlyoverAerialServices.Columns.CSVFile.EQ(psql.Arg(o.FileID))), )...) } func (os FileuploadCSVSlice) CSVFileFlyoverAerialServices(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadFlyoverAerialServicesQuery { pkFileID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue } pkFileID = append(pkFileID, o.FileID) } PKArgExpr := psql.Select(sm.Columns( psql.F("unnest", psql.Cast(psql.Arg(pkFileID), "integer[]")), )) return FileuploadFlyoverAerialServices.Query(append(mods, sm.Where(psql.Group(FileuploadFlyoverAerialServices.Columns.CSVFile).OP("IN", PKArgExpr)), )...) } // CSVFilePools starts a query for related objects on fileupload.pool func (o *FileuploadCSV) CSVFilePools(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadPoolsQuery { return FileuploadPools.Query(append(mods, sm.Where(FileuploadPools.Columns.CSVFile.EQ(psql.Arg(o.FileID))), )...) } func (os FileuploadCSVSlice) CSVFilePools(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadPoolsQuery { pkFileID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue } pkFileID = append(pkFileID, o.FileID) } PKArgExpr := psql.Select(sm.Columns( psql.F("unnest", psql.Cast(psql.Arg(pkFileID), "integer[]")), )) return FileuploadPools.Query(append(mods, sm.Where(psql.Group(FileuploadPools.Columns.CSVFile).OP("IN", PKArgExpr)), )...) } func attachFileuploadCSVFile0(ctx context.Context, exec bob.Executor, count int, fileuploadCSV0 *FileuploadCSV, fileuploadFile1 *FileuploadFile) (*FileuploadCSV, error) { setter := &FileuploadCSVSetter{ FileID: omit.From(fileuploadFile1.ID), } err := fileuploadCSV0.Update(ctx, exec, setter) if err != nil { return nil, fmt.Errorf("attachFileuploadCSVFile0: %w", err) } return fileuploadCSV0, nil } func (fileuploadCSV0 *FileuploadCSV) InsertFile(ctx context.Context, exec bob.Executor, related *FileuploadFileSetter) error { var err error fileuploadFile1, err := FileuploadFiles.Insert(related).One(ctx, exec) if err != nil { return fmt.Errorf("inserting related objects: %w", err) } _, err = attachFileuploadCSVFile0(ctx, exec, 1, fileuploadCSV0, fileuploadFile1) if err != nil { return err } fileuploadCSV0.R.File = fileuploadFile1 fileuploadFile1.R.CSV = fileuploadCSV0 return nil } func (fileuploadCSV0 *FileuploadCSV) AttachFile(ctx context.Context, exec bob.Executor, fileuploadFile1 *FileuploadFile) error { var err error _, err = attachFileuploadCSVFile0(ctx, exec, 1, fileuploadCSV0, fileuploadFile1) if err != nil { return err } fileuploadCSV0.R.File = fileuploadFile1 fileuploadFile1.R.CSV = fileuploadCSV0 return nil } func insertFileuploadCSVCSVFileErrorCSVS0(ctx context.Context, exec bob.Executor, fileuploadErrorCSVS1 []*FileuploadErrorCSVSetter, fileuploadCSV0 *FileuploadCSV) (FileuploadErrorCSVSlice, error) { for i := range fileuploadErrorCSVS1 { fileuploadErrorCSVS1[i].CSVFileID = omit.From(fileuploadCSV0.FileID) } ret, err := FileuploadErrorCSVS.Insert(bob.ToMods(fileuploadErrorCSVS1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertFileuploadCSVCSVFileErrorCSVS0: %w", err) } return ret, nil } func attachFileuploadCSVCSVFileErrorCSVS0(ctx context.Context, exec bob.Executor, count int, fileuploadErrorCSVS1 FileuploadErrorCSVSlice, fileuploadCSV0 *FileuploadCSV) (FileuploadErrorCSVSlice, error) { setter := &FileuploadErrorCSVSetter{ CSVFileID: omit.From(fileuploadCSV0.FileID), } err := fileuploadErrorCSVS1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachFileuploadCSVCSVFileErrorCSVS0: %w", err) } return fileuploadErrorCSVS1, nil } func (fileuploadCSV0 *FileuploadCSV) InsertCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, related ...*FileuploadErrorCSVSetter) error { if len(related) == 0 { return nil } var err error fileuploadErrorCSVS1, err := insertFileuploadCSVCSVFileErrorCSVS0(ctx, exec, related, fileuploadCSV0) if err != nil { return err } fileuploadCSV0.R.CSVFileErrorCSVS = append(fileuploadCSV0.R.CSVFileErrorCSVS, fileuploadErrorCSVS1...) for _, rel := range fileuploadErrorCSVS1 { rel.R.CSVFileCSV = fileuploadCSV0 } return nil } func (fileuploadCSV0 *FileuploadCSV) AttachCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, related ...*FileuploadErrorCSV) error { if len(related) == 0 { return nil } var err error fileuploadErrorCSVS1 := FileuploadErrorCSVSlice(related) _, err = attachFileuploadCSVCSVFileErrorCSVS0(ctx, exec, len(related), fileuploadErrorCSVS1, fileuploadCSV0) if err != nil { return err } fileuploadCSV0.R.CSVFileErrorCSVS = append(fileuploadCSV0.R.CSVFileErrorCSVS, fileuploadErrorCSVS1...) for _, rel := range related { rel.R.CSVFileCSV = fileuploadCSV0 } return nil } func insertFileuploadCSVCSVFileFlyoverAerialServices0(ctx context.Context, exec bob.Executor, fileuploadFlyoverAerialServices1 []*FileuploadFlyoverAerialServiceSetter, fileuploadCSV0 *FileuploadCSV) (FileuploadFlyoverAerialServiceSlice, error) { for i := range fileuploadFlyoverAerialServices1 { fileuploadFlyoverAerialServices1[i].CSVFile = omit.From(fileuploadCSV0.FileID) } ret, err := FileuploadFlyoverAerialServices.Insert(bob.ToMods(fileuploadFlyoverAerialServices1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertFileuploadCSVCSVFileFlyoverAerialServices0: %w", err) } return ret, nil } func attachFileuploadCSVCSVFileFlyoverAerialServices0(ctx context.Context, exec bob.Executor, count int, fileuploadFlyoverAerialServices1 FileuploadFlyoverAerialServiceSlice, fileuploadCSV0 *FileuploadCSV) (FileuploadFlyoverAerialServiceSlice, error) { setter := &FileuploadFlyoverAerialServiceSetter{ CSVFile: omit.From(fileuploadCSV0.FileID), } err := fileuploadFlyoverAerialServices1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachFileuploadCSVCSVFileFlyoverAerialServices0: %w", err) } return fileuploadFlyoverAerialServices1, nil } func (fileuploadCSV0 *FileuploadCSV) InsertCSVFileFlyoverAerialServices(ctx context.Context, exec bob.Executor, related ...*FileuploadFlyoverAerialServiceSetter) error { if len(related) == 0 { return nil } var err error fileuploadFlyoverAerialServices1, err := insertFileuploadCSVCSVFileFlyoverAerialServices0(ctx, exec, related, fileuploadCSV0) if err != nil { return err } fileuploadCSV0.R.CSVFileFlyoverAerialServices = append(fileuploadCSV0.R.CSVFileFlyoverAerialServices, fileuploadFlyoverAerialServices1...) for _, rel := range fileuploadFlyoverAerialServices1 { rel.R.CSVFileCSV = fileuploadCSV0 } return nil } func (fileuploadCSV0 *FileuploadCSV) AttachCSVFileFlyoverAerialServices(ctx context.Context, exec bob.Executor, related ...*FileuploadFlyoverAerialService) error { if len(related) == 0 { return nil } var err error fileuploadFlyoverAerialServices1 := FileuploadFlyoverAerialServiceSlice(related) _, err = attachFileuploadCSVCSVFileFlyoverAerialServices0(ctx, exec, len(related), fileuploadFlyoverAerialServices1, fileuploadCSV0) if err != nil { return err } fileuploadCSV0.R.CSVFileFlyoverAerialServices = append(fileuploadCSV0.R.CSVFileFlyoverAerialServices, fileuploadFlyoverAerialServices1...) for _, rel := range related { rel.R.CSVFileCSV = fileuploadCSV0 } return nil } func insertFileuploadCSVCSVFilePools0(ctx context.Context, exec bob.Executor, fileuploadPools1 []*FileuploadPoolSetter, fileuploadCSV0 *FileuploadCSV) (FileuploadPoolSlice, error) { for i := range fileuploadPools1 { fileuploadPools1[i].CSVFile = omit.From(fileuploadCSV0.FileID) } ret, err := FileuploadPools.Insert(bob.ToMods(fileuploadPools1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertFileuploadCSVCSVFilePools0: %w", err) } return ret, nil } func attachFileuploadCSVCSVFilePools0(ctx context.Context, exec bob.Executor, count int, fileuploadPools1 FileuploadPoolSlice, fileuploadCSV0 *FileuploadCSV) (FileuploadPoolSlice, error) { setter := &FileuploadPoolSetter{ CSVFile: omit.From(fileuploadCSV0.FileID), } err := fileuploadPools1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachFileuploadCSVCSVFilePools0: %w", err) } return fileuploadPools1, nil } func (fileuploadCSV0 *FileuploadCSV) InsertCSVFilePools(ctx context.Context, exec bob.Executor, related ...*FileuploadPoolSetter) error { if len(related) == 0 { return nil } var err error fileuploadPools1, err := insertFileuploadCSVCSVFilePools0(ctx, exec, related, fileuploadCSV0) if err != nil { return err } fileuploadCSV0.R.CSVFilePools = append(fileuploadCSV0.R.CSVFilePools, fileuploadPools1...) for _, rel := range fileuploadPools1 { rel.R.CSVFileCSV = fileuploadCSV0 } return nil } func (fileuploadCSV0 *FileuploadCSV) AttachCSVFilePools(ctx context.Context, exec bob.Executor, related ...*FileuploadPool) error { if len(related) == 0 { return nil } var err error fileuploadPools1 := FileuploadPoolSlice(related) _, err = attachFileuploadCSVCSVFilePools0(ctx, exec, len(related), fileuploadPools1, fileuploadCSV0) if err != nil { return err } fileuploadCSV0.R.CSVFilePools = append(fileuploadCSV0.R.CSVFilePools, fileuploadPools1...) for _, rel := range related { rel.R.CSVFileCSV = fileuploadCSV0 } return nil } type fileuploadCSVWhere[Q psql.Filterable] struct { Committed psql.WhereNullMod[Q, time.Time] FileID psql.WhereMod[Q, int32] Rowcount psql.WhereMod[Q, int32] Type psql.WhereMod[Q, enums.FileuploadCsvtype] } func (fileuploadCSVWhere[Q]) AliasedAs(alias string) fileuploadCSVWhere[Q] { return buildFileuploadCSVWhere[Q](buildFileuploadCSVColumns(alias)) } func buildFileuploadCSVWhere[Q psql.Filterable](cols fileuploadCSVColumns) fileuploadCSVWhere[Q] { return fileuploadCSVWhere[Q]{ Committed: psql.WhereNull[Q, time.Time](cols.Committed), FileID: psql.Where[Q, int32](cols.FileID), Rowcount: psql.Where[Q, int32](cols.Rowcount), Type: psql.Where[Q, enums.FileuploadCsvtype](cols.Type), } } func (o *FileuploadCSV) Preload(name string, retrieved any) error { if o == nil { return nil } switch name { case "File": rel, ok := retrieved.(*FileuploadFile) if !ok { return fmt.Errorf("fileuploadCSV cannot load %T as %q", retrieved, name) } o.R.File = rel if rel != nil { rel.R.CSV = o } return nil case "CSVFileErrorCSVS": rels, ok := retrieved.(FileuploadErrorCSVSlice) if !ok { return fmt.Errorf("fileuploadCSV cannot load %T as %q", retrieved, name) } o.R.CSVFileErrorCSVS = rels for _, rel := range rels { if rel != nil { rel.R.CSVFileCSV = o } } return nil case "CSVFileFlyoverAerialServices": rels, ok := retrieved.(FileuploadFlyoverAerialServiceSlice) if !ok { return fmt.Errorf("fileuploadCSV cannot load %T as %q", retrieved, name) } o.R.CSVFileFlyoverAerialServices = rels for _, rel := range rels { if rel != nil { rel.R.CSVFileCSV = o } } return nil case "CSVFilePools": rels, ok := retrieved.(FileuploadPoolSlice) if !ok { return fmt.Errorf("fileuploadCSV cannot load %T as %q", retrieved, name) } o.R.CSVFilePools = rels for _, rel := range rels { if rel != nil { rel.R.CSVFileCSV = o } } return nil default: return fmt.Errorf("fileuploadCSV has no relationship %q", name) } } type fileuploadCSVPreloader struct { File func(...psql.PreloadOption) psql.Preloader } func buildFileuploadCSVPreloader() fileuploadCSVPreloader { return fileuploadCSVPreloader{ File: func(opts ...psql.PreloadOption) psql.Preloader { return psql.Preload[*FileuploadFile, FileuploadFileSlice](psql.PreloadRel{ Name: "File", Sides: []psql.PreloadSide{ { From: FileuploadCSVS, To: FileuploadFiles, FromColumns: []string{"file_id"}, ToColumns: []string{"id"}, }, }, }, FileuploadFiles.Columns.Names(), opts...) }, } } type fileuploadCSVThenLoader[Q orm.Loadable] struct { File func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CSVFileErrorCSVS func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CSVFileFlyoverAerialServices func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CSVFilePools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } func buildFileuploadCSVThenLoader[Q orm.Loadable]() fileuploadCSVThenLoader[Q] { type FileLoadInterface interface { LoadFile(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type CSVFileErrorCSVSLoadInterface interface { LoadCSVFileErrorCSVS(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type CSVFileFlyoverAerialServicesLoadInterface interface { LoadCSVFileFlyoverAerialServices(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type CSVFilePoolsLoadInterface interface { LoadCSVFilePools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } return fileuploadCSVThenLoader[Q]{ File: thenLoadBuilder[Q]( "File", func(ctx context.Context, exec bob.Executor, retrieved FileLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadFile(ctx, exec, mods...) }, ), CSVFileErrorCSVS: thenLoadBuilder[Q]( "CSVFileErrorCSVS", func(ctx context.Context, exec bob.Executor, retrieved CSVFileErrorCSVSLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCSVFileErrorCSVS(ctx, exec, mods...) }, ), CSVFileFlyoverAerialServices: thenLoadBuilder[Q]( "CSVFileFlyoverAerialServices", func(ctx context.Context, exec bob.Executor, retrieved CSVFileFlyoverAerialServicesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCSVFileFlyoverAerialServices(ctx, exec, mods...) }, ), CSVFilePools: thenLoadBuilder[Q]( "CSVFilePools", func(ctx context.Context, exec bob.Executor, retrieved CSVFilePoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCSVFilePools(ctx, exec, mods...) }, ), } } // LoadFile loads the fileuploadCSV's File into the .R struct func (o *FileuploadCSV) LoadFile(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.File = nil related, err := o.File(mods...).One(ctx, exec) if err != nil { return err } related.R.CSV = o o.R.File = related return nil } // LoadFile loads the fileuploadCSV's File into the .R struct func (os FileuploadCSVSlice) LoadFile(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } fileuploadFiles, err := os.File(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } for _, rel := range fileuploadFiles { if !(o.FileID == rel.ID) { continue } rel.R.CSV = o o.R.File = rel break } } return nil } // LoadCSVFileErrorCSVS loads the fileuploadCSV's CSVFileErrorCSVS into the .R struct func (o *FileuploadCSV) LoadCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.CSVFileErrorCSVS = nil related, err := o.CSVFileErrorCSVS(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.CSVFileCSV = o } o.R.CSVFileErrorCSVS = related return nil } // LoadCSVFileErrorCSVS loads the fileuploadCSV's CSVFileErrorCSVS into the .R struct func (os FileuploadCSVSlice) LoadCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } fileuploadErrorCSVS, err := os.CSVFileErrorCSVS(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.CSVFileErrorCSVS = nil } for _, o := range os { if o == nil { continue } for _, rel := range fileuploadErrorCSVS { if !(o.FileID == rel.CSVFileID) { continue } rel.R.CSVFileCSV = o o.R.CSVFileErrorCSVS = append(o.R.CSVFileErrorCSVS, rel) } } return nil } // LoadCSVFileFlyoverAerialServices loads the fileuploadCSV's CSVFileFlyoverAerialServices into the .R struct func (o *FileuploadCSV) LoadCSVFileFlyoverAerialServices(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.CSVFileFlyoverAerialServices = nil related, err := o.CSVFileFlyoverAerialServices(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.CSVFileCSV = o } o.R.CSVFileFlyoverAerialServices = related return nil } // LoadCSVFileFlyoverAerialServices loads the fileuploadCSV's CSVFileFlyoverAerialServices into the .R struct func (os FileuploadCSVSlice) LoadCSVFileFlyoverAerialServices(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } fileuploadFlyoverAerialServices, err := os.CSVFileFlyoverAerialServices(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.CSVFileFlyoverAerialServices = nil } for _, o := range os { if o == nil { continue } for _, rel := range fileuploadFlyoverAerialServices { if !(o.FileID == rel.CSVFile) { continue } rel.R.CSVFileCSV = o o.R.CSVFileFlyoverAerialServices = append(o.R.CSVFileFlyoverAerialServices, rel) } } return nil } // LoadCSVFilePools loads the fileuploadCSV's CSVFilePools into the .R struct func (o *FileuploadCSV) LoadCSVFilePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.CSVFilePools = nil related, err := o.CSVFilePools(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.CSVFileCSV = o } o.R.CSVFilePools = related return nil } // LoadCSVFilePools loads the fileuploadCSV's CSVFilePools into the .R struct func (os FileuploadCSVSlice) LoadCSVFilePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } fileuploadPools, err := os.CSVFilePools(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.CSVFilePools = nil } for _, o := range os { if o == nil { continue } for _, rel := range fileuploadPools { if !(o.FileID == rel.CSVFile) { continue } rel.R.CSVFileCSV = o o.R.CSVFilePools = append(o.R.CSVFilePools, rel) } } return nil } // fileuploadCSVC is where relationship counts are stored. type fileuploadCSVC struct { CSVFileErrorCSVS *int64 CSVFileFlyoverAerialServices *int64 CSVFilePools *int64 } // PreloadCount sets a count in the C struct by name func (o *FileuploadCSV) PreloadCount(name string, count int64) error { if o == nil { return nil } switch name { case "CSVFileErrorCSVS": o.C.CSVFileErrorCSVS = &count case "CSVFileFlyoverAerialServices": o.C.CSVFileFlyoverAerialServices = &count case "CSVFilePools": o.C.CSVFilePools = &count } return nil } type fileuploadCSVCountPreloader struct { CSVFileErrorCSVS func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader CSVFileFlyoverAerialServices func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader CSVFilePools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader } func buildFileuploadCSVCountPreloader() fileuploadCSVCountPreloader { return fileuploadCSVCountPreloader{ CSVFileErrorCSVS: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { return countPreloader[*FileuploadCSV]("CSVFileErrorCSVS", func(parent string) bob.Expression { // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) if parent == "" { parent = FileuploadCSVS.Alias() } subqueryMods := []bob.Mod[*dialect.SelectQuery]{ sm.Columns(psql.Raw("count(*)")), sm.From(FileuploadErrorCSVS.Name()), sm.Where(psql.Quote(FileuploadErrorCSVS.Alias(), "csv_file_id").EQ(psql.Quote(parent, "file_id"))), } subqueryMods = append(subqueryMods, mods...) return psql.Group(psql.Select(subqueryMods...).Expression) }) }, CSVFileFlyoverAerialServices: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { return countPreloader[*FileuploadCSV]("CSVFileFlyoverAerialServices", func(parent string) bob.Expression { // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) if parent == "" { parent = FileuploadCSVS.Alias() } subqueryMods := []bob.Mod[*dialect.SelectQuery]{ sm.Columns(psql.Raw("count(*)")), sm.From(FileuploadFlyoverAerialServices.Name()), sm.Where(psql.Quote(FileuploadFlyoverAerialServices.Alias(), "csv_file").EQ(psql.Quote(parent, "file_id"))), } subqueryMods = append(subqueryMods, mods...) return psql.Group(psql.Select(subqueryMods...).Expression) }) }, CSVFilePools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { return countPreloader[*FileuploadCSV]("CSVFilePools", func(parent string) bob.Expression { // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) if parent == "" { parent = FileuploadCSVS.Alias() } subqueryMods := []bob.Mod[*dialect.SelectQuery]{ sm.Columns(psql.Raw("count(*)")), sm.From(FileuploadPools.Name()), sm.Where(psql.Quote(FileuploadPools.Alias(), "csv_file").EQ(psql.Quote(parent, "file_id"))), } subqueryMods = append(subqueryMods, mods...) return psql.Group(psql.Select(subqueryMods...).Expression) }) }, } } type fileuploadCSVCountThenLoader[Q orm.Loadable] struct { CSVFileErrorCSVS func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CSVFileFlyoverAerialServices func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CSVFilePools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } func buildFileuploadCSVCountThenLoader[Q orm.Loadable]() fileuploadCSVCountThenLoader[Q] { type CSVFileErrorCSVSCountInterface interface { LoadCountCSVFileErrorCSVS(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type CSVFileFlyoverAerialServicesCountInterface interface { LoadCountCSVFileFlyoverAerialServices(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type CSVFilePoolsCountInterface interface { LoadCountCSVFilePools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } return fileuploadCSVCountThenLoader[Q]{ CSVFileErrorCSVS: countThenLoadBuilder[Q]( "CSVFileErrorCSVS", func(ctx context.Context, exec bob.Executor, retrieved CSVFileErrorCSVSCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCountCSVFileErrorCSVS(ctx, exec, mods...) }, ), CSVFileFlyoverAerialServices: countThenLoadBuilder[Q]( "CSVFileFlyoverAerialServices", func(ctx context.Context, exec bob.Executor, retrieved CSVFileFlyoverAerialServicesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCountCSVFileFlyoverAerialServices(ctx, exec, mods...) }, ), CSVFilePools: countThenLoadBuilder[Q]( "CSVFilePools", func(ctx context.Context, exec bob.Executor, retrieved CSVFilePoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCountCSVFilePools(ctx, exec, mods...) }, ), } } // LoadCountCSVFileErrorCSVS loads the count of CSVFileErrorCSVS into the C struct func (o *FileuploadCSV) LoadCountCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } count, err := o.CSVFileErrorCSVS(mods...).Count(ctx, exec) if err != nil { return err } o.C.CSVFileErrorCSVS = &count return nil } // LoadCountCSVFileErrorCSVS loads the count of CSVFileErrorCSVS for a slice func (os FileuploadCSVSlice) LoadCountCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } for _, o := range os { if err := o.LoadCountCSVFileErrorCSVS(ctx, exec, mods...); err != nil { return err } } return nil } // LoadCountCSVFileFlyoverAerialServices loads the count of CSVFileFlyoverAerialServices into the C struct func (o *FileuploadCSV) LoadCountCSVFileFlyoverAerialServices(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } count, err := o.CSVFileFlyoverAerialServices(mods...).Count(ctx, exec) if err != nil { return err } o.C.CSVFileFlyoverAerialServices = &count return nil } // LoadCountCSVFileFlyoverAerialServices loads the count of CSVFileFlyoverAerialServices for a slice func (os FileuploadCSVSlice) LoadCountCSVFileFlyoverAerialServices(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } for _, o := range os { if err := o.LoadCountCSVFileFlyoverAerialServices(ctx, exec, mods...); err != nil { return err } } return nil } // LoadCountCSVFilePools loads the count of CSVFilePools into the C struct func (o *FileuploadCSV) LoadCountCSVFilePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } count, err := o.CSVFilePools(mods...).Count(ctx, exec) if err != nil { return err } o.C.CSVFilePools = &count return nil } // LoadCountCSVFilePools loads the count of CSVFilePools for a slice func (os FileuploadCSVSlice) LoadCountCSVFilePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } for _, o := range os { if err := o.LoadCountCSVFilePools(ctx, exec, mods...); err != nil { return err } } return nil } type fileuploadCSVJoins[Q dialect.Joinable] struct { typ string File modAs[Q, fileuploadFileColumns] CSVFileErrorCSVS modAs[Q, fileuploadErrorCSVColumns] CSVFileFlyoverAerialServices modAs[Q, fileuploadFlyoverAerialServiceColumns] CSVFilePools modAs[Q, fileuploadPoolColumns] } func (j fileuploadCSVJoins[Q]) aliasedAs(alias string) fileuploadCSVJoins[Q] { return buildFileuploadCSVJoins[Q](buildFileuploadCSVColumns(alias), j.typ) } func buildFileuploadCSVJoins[Q dialect.Joinable](cols fileuploadCSVColumns, typ string) fileuploadCSVJoins[Q] { return fileuploadCSVJoins[Q]{ typ: typ, File: modAs[Q, fileuploadFileColumns]{ c: FileuploadFiles.Columns, f: func(to fileuploadFileColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, FileuploadFiles.Name().As(to.Alias())).On( to.ID.EQ(cols.FileID), )) } return mods }, }, CSVFileErrorCSVS: modAs[Q, fileuploadErrorCSVColumns]{ c: FileuploadErrorCSVS.Columns, f: func(to fileuploadErrorCSVColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, FileuploadErrorCSVS.Name().As(to.Alias())).On( to.CSVFileID.EQ(cols.FileID), )) } return mods }, }, CSVFileFlyoverAerialServices: modAs[Q, fileuploadFlyoverAerialServiceColumns]{ c: FileuploadFlyoverAerialServices.Columns, f: func(to fileuploadFlyoverAerialServiceColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, FileuploadFlyoverAerialServices.Name().As(to.Alias())).On( to.CSVFile.EQ(cols.FileID), )) } return mods }, }, CSVFilePools: modAs[Q, fileuploadPoolColumns]{ c: FileuploadPools.Columns, f: func(to fileuploadPoolColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, FileuploadPools.Name().As(to.Alias())).On( to.CSVFile.EQ(cols.FileID), )) } return mods }, }, } }