diff --git a/arcgis.go b/arcgis.go index d71ff60a..0c2d0d4a 100644 --- a/arcgis.go +++ b/arcgis.go @@ -239,6 +239,19 @@ func refreshFieldseekerData(ctx context.Context, newOauthCh <-chan struct{}) { }() } + orgs, err := models.Organizations.Query().All(ctx, PGInstance.BobDB) + if err != nil { + slog.Error("Failed to get orgs", slog.String("err", err.Error())) + return + } + for _, org := range orgs { + wg.Add(1) + go func() { + defer wg.Done() + periodicallyExportFieldseeker(workerCtx, org) + }() + } + select { case <-ctx.Done(): slog.Info("Exiting refresh worker...") @@ -253,17 +266,17 @@ func refreshFieldseekerData(ctx context.Context, newOauthCh <-chan struct{}) { } } -func downloadAllRecords(ctx context.Context, fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature) (int, int, error) { +func downloadAllRecords(ctx context.Context, fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature, org_id int32) (int, int, int, error) { inserts := 0 updates := 0 offset := 0 count, err := fssync.QueryCount(layer.ID) if err != nil { - return inserts, updates, fmt.Errorf("Failed to get counts for layer %s (%d): %v", layer.Name, layer.ID, err) + return inserts, updates, 0, fmt.Errorf("Failed to get counts for layer %s (%d): %v", layer.Name, layer.ID, err) } slog.Info("Starting on layer", slog.String("name", layer.Name), slog.Int("id", layer.ID)) if count.Count == 0 { - return inserts, updates, nil + return inserts, updates, 0, nil } for { if offset >= count.Count { @@ -279,22 +292,58 @@ func downloadAllRecords(ctx context.Context, fssync *fieldseeker.FieldSeeker, la layer.ID, query) if err != nil { - return inserts, updates, fmt.Errorf("Failed to get layer %s (%d) at offset %d: %v", layer.Name, layer.ID, offset, err) + return inserts, updates, count.Count - inserts - updates, fmt.Errorf("Failed to get layer %s (%d) at offset %d: %v", layer.Name, layer.ID, offset, err) } - i, u, err := saveOrUpdateDBRecords(ctx, "FS_"+layer.Name, qr) + i, u, err := saveOrUpdateDBRecords(ctx, "FS_"+layer.Name, qr, org_id) if err != nil { saveRawQuery(fssync, layer, query, "failure.json") - return inserts, updates, fmt.Errorf("Failed to save records: %v", err) + return inserts, updates, count.Count - inserts - updates, fmt.Errorf("Failed to save records: %v", err) } inserts += i updates += u offset += len(qr.Features) } slog.Info("Finished layer", slog.Int("inserts", inserts), slog.Int("updates", updates), slog.Int("no change", count.Count-inserts-updates)) - return inserts, updates, nil + return inserts, updates, count.Count - inserts - updates, nil } -func exportFieldseekerData(ctx context.Context, oauth *models.OauthToken) error { +func getOAuthForOrg(ctx context.Context, org *models.Organization) (*models.OauthToken, error) { + users, err := org.User().All(ctx, PGInstance.BobDB) + if err != nil { + return nil, fmt.Errorf("Failed to query all users for org: %v", err) + } + for _, user := range users { + oauths, err := user.UserOauthTokens().All(ctx, PGInstance.BobDB) + if err != nil { + return nil, fmt.Errorf("Failed to query all oauth tokens for org: %v", err) + } + for _, oauth := range oauths { + return oauth, nil + } + } + return nil, errors.New("No oauth tokens found") +} + +func periodicallyExportFieldseeker(ctx context.Context, org *models.Organization) error { + pollTicker := time.NewTicker(1) + for { + select { + case <-ctx.Done(): + return nil + case <-pollTicker.C: + oauth, err := getOAuthForOrg(ctx, org) + if err != nil { + return fmt.Errorf("Failed to get oauth for org: %v", err) + } + err = exportFieldseekerData(ctx, org, oauth) + if err != nil { + return fmt.Errorf("Failed to export Fieldseeker data: %v", err) + } + pollTicker = time.NewTicker(15 * time.Minute) + } + } +} +func exportFieldseekerData(ctx context.Context, org *models.Organization, oauth *models.OauthToken) error { slog.Info("Update Fieldseeker data") ar := arcgis.NewArcGIS( arcgis.AuthenticatorOAuth{ @@ -317,15 +366,25 @@ func exportFieldseekerData(ctx context.Context, oauth *models.OauthToken) error } inserts := 0 updates := 0 + unchanged := 0 for _, layer := range fssync.FeatureServerLayers() { - i, u, err := downloadAllRecords(ctx, fssync, layer) + i, u, un, err := downloadAllRecords(ctx, fssync, layer, row.OrganizationID) if err != nil { return fmt.Errorf("Failed to get layer %s: %v", layer, err) } inserts += i updates += u + unchanged += un } + setter := models.FieldseekerSyncSetter{ + RecordsCreated: omit.From(int32(inserts)), + RecordsUpdated: omit.From(int32(updates)), + RecordsUnchanged: omit.From(int32(unchanged)), + } + err = org.InsertFieldseekerSyncs(ctx, PGInstance.BobDB, &setter) + //err = user.InsertUserOauthTokens(ctx, PGInstance.BobDB, &setter) + return nil } @@ -341,7 +400,6 @@ func maintainOAuth(ctx context.Context, oauth *models.OauthToken) { refreshDelay = time.Until(oauth.AccessTokenExpires) } refreshTicker := time.NewTicker(refreshDelay) - pollTicker := time.NewTicker(1) for { select { case <-ctx.Done(): @@ -352,12 +410,6 @@ func maintainOAuth(ctx context.Context, oauth *models.OauthToken) { slog.Error("Failed to refresh token", slog.String("err", err.Error())) return } - case <-pollTicker.C: - err := exportFieldseekerData(ctx, oauth) - if err != nil { - slog.Error("Failed to export Fieldseeker data", slog.String("err", err.Error())) - } - pollTicker = time.NewTicker(15 * time.Minute) } } @@ -501,7 +553,7 @@ func saveRawQuery(fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature, qu slog.Info("Wrote failed query", slog.String("filename", filename)) } -func saveOrUpdateDBRecords(ctx context.Context, table string, qr *arcgis.QueryResult) (int, int, error) { +func saveOrUpdateDBRecords(ctx context.Context, table string, qr *arcgis.QueryResult, org_id int32) (int, int, error) { inserts, updates := 0, 0 sorted_columns := make([]string, 0, len(qr.Fields)) for _, f := range qr.Fields { @@ -527,12 +579,12 @@ func saveOrUpdateDBRecords(ctx context.Context, table string, qr *arcgis.QueryRe // If we have no matching row we'll need to create it if len(row) == 0 { - if err := insertRowFromFeature(ctx, table, sorted_columns, &feature); err != nil { + if err := insertRowFromFeature(ctx, table, sorted_columns, &feature, org_id); err != nil { return inserts, updates, fmt.Errorf("Failed to insert row: %v", err) } inserts += 1 } else if hasUpdates(row, feature) { - if err := updateRowFromFeature(ctx, table, sorted_columns, &feature); err != nil { + if err := updateRowFromFeature(ctx, table, sorted_columns, &feature, org_id); err != nil { return inserts, updates, fmt.Errorf("Failed to update row: %v", err) } updates += 1 @@ -603,20 +655,20 @@ func rowmapViaQuery(ctx context.Context, table string, sorted_columns []string, return result, nil } -func insertRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature) error { +func insertRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32) error { var options pgx.TxOptions transaction, err := PGInstance.PGXPool.BeginTx(ctx, options) if err != nil { return fmt.Errorf("Unable to start transaction") } - err = insertRowFromFeatureFS(ctx, transaction, table, sorted_columns, feature) + err = insertRowFromFeatureFS(ctx, transaction, table, sorted_columns, feature, org_id) if err != nil { transaction.Rollback(ctx) return fmt.Errorf("Unable to insert FS: %v", err) } - err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, 1) + err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, org_id, 1) if err != nil { transaction.Rollback(ctx) return fmt.Errorf("Failed to insert history: %v", err) @@ -629,7 +681,7 @@ func insertRowFromFeature(ctx context.Context, table string, sorted_columns []st return nil } -func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature) error { +func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32) error { // Create the query to produce the main row var sb strings.Builder sb.WriteString("INSERT INTO ") @@ -640,7 +692,7 @@ func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table strin sb.WriteString(",") } // Specially add the geometry values since they aren't in the fields - sb.WriteString("geometry_x,geometry_y,updated") + sb.WriteString("geometry_x,geometry_y,organization_id,updated") sb.WriteString(")\nVALUES (") for _, field := range sorted_columns { sb.WriteString("@") @@ -648,7 +700,7 @@ func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table strin sb.WriteString(",") } // Specially add the geometry values since they aren't in the fields - sb.WriteString("@geometry_x,@geometry_y,@updated)") + sb.WriteString("@geometry_x,@geometry_y,@organization_id,@updated)") args := pgx.NamedArgs{} for k, v := range feature.Attributes { @@ -657,6 +709,7 @@ func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table strin // specially add geometry since it isn't in the list of attributes args["geometry_x"] = feature.Geometry.X args["geometry_y"] = feature.Geometry.Y + args["organization_id"] = org_id args["updated"] = time.Now() _, err := transaction.Exec(ctx, sb.String(), args) @@ -718,7 +771,7 @@ func hasUpdates(row map[string]string, feature arcgis.Feature) bool { } return false } -func updateRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature) error { +func updateRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32) error { // Get the current highest version for the row in question history_table := toHistoryTable(table) var sb strings.Builder @@ -741,7 +794,7 @@ func updateRowFromFeature(ctx context.Context, table string, sorted_columns []st return fmt.Errorf("Unable to start transaction") } - err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, version+1) + err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, org_id, version+1) if err != nil { transaction.Rollback(ctx) return fmt.Errorf("Failed to insert history: %v", err) @@ -758,7 +811,7 @@ func updateRowFromFeature(ctx context.Context, table string, sorted_columns []st } return nil } -func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature, version int) error { +func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32, version int) error { history_table := toHistoryTable(table) var sb strings.Builder sb.WriteString("INSERT INTO ") @@ -769,7 +822,7 @@ func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table sb.WriteString(",") } // Specially add the geometry values since they aren't in the fields - sb.WriteString("created,geometry_x,geometry_y,version") + sb.WriteString("created,geometry_x,geometry_y,organization_id,version") sb.WriteString(")\nVALUES (") for _, field := range sorted_columns { sb.WriteString("@") @@ -777,12 +830,13 @@ func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table sb.WriteString(",") } // Specially add the geometry values since they aren't in the fields - sb.WriteString("@created,@geometry_x,@geometry_y,@version)") + sb.WriteString("@created,@geometry_x,@geometry_y,@organization_id,@version)") args := pgx.NamedArgs{} for k, v := range feature.Attributes { args[k] = v } args["created"] = time.Now() + args["organization_id"] = org_id args["version"] = version if _, err := transaction.Exec(ctx, sb.String(), args); err != nil { return fmt.Errorf("Failed to insert history row into %s: %v", table, err) diff --git a/dberrors/fieldseeker_sync.bob.go b/dberrors/fieldseeker_sync.bob.go new file mode 100644 index 00000000..22112a0b --- /dev/null +++ b/dberrors/fieldseeker_sync.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.41.1. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var FieldseekerSyncErrors = &fieldseekerSyncErrors{ + ErrUniqueFieldseekerSyncPkey: &UniqueConstraintError{ + schema: "", + table: "fieldseeker_sync", + columns: []string{"id"}, + s: "fieldseeker_sync_pkey", + }, +} + +type fieldseekerSyncErrors struct { + ErrUniqueFieldseekerSyncPkey *UniqueConstraintError +} diff --git a/dbinfo/fieldseeker_sync.bob.go b/dbinfo/fieldseeker_sync.bob.go new file mode 100644 index 00000000..01c30cf6 --- /dev/null +++ b/dbinfo/fieldseeker_sync.bob.go @@ -0,0 +1,157 @@ +// Code generated by BobGen psql v0.41.1. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dbinfo + +import "github.com/aarondl/opt/null" + +var FieldseekerSyncs = Table[ + fieldseekerSyncColumns, + fieldseekerSyncIndexes, + fieldseekerSyncForeignKeys, + fieldseekerSyncUniques, + fieldseekerSyncChecks, +]{ + Schema: "", + Name: "fieldseeker_sync", + Columns: fieldseekerSyncColumns{ + ID: column{ + Name: "id", + DBType: "integer", + Default: "nextval('fieldseeker_sync_id_seq'::regclass)", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "CURRENT_TIMESTAMP", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + RecordsCreated: column{ + Name: "records_created", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + RecordsUpdated: column{ + Name: "records_updated", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + RecordsUnchanged: column{ + Name: "records_unchanged", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: fieldseekerSyncIndexes{ + FieldseekerSyncPkey: index{ + Type: "btree", + Name: "fieldseeker_sync_pkey", + Columns: []indexColumn{ + { + Name: "id", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "fieldseeker_sync_pkey", + Columns: []string{"id"}, + Comment: "", + }, + ForeignKeys: fieldseekerSyncForeignKeys{ + FieldseekerSyncFieldseekerSyncOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker_sync.fieldseeker_sync_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type fieldseekerSyncColumns struct { + ID column + Created column + RecordsCreated column + RecordsUpdated column + RecordsUnchanged column + OrganizationID column +} + +func (c fieldseekerSyncColumns) AsSlice() []column { + return []column{ + c.ID, c.Created, c.RecordsCreated, c.RecordsUpdated, c.RecordsUnchanged, c.OrganizationID, + } +} + +type fieldseekerSyncIndexes struct { + FieldseekerSyncPkey index +} + +func (i fieldseekerSyncIndexes) AsSlice() []index { + return []index{ + i.FieldseekerSyncPkey, + } +} + +type fieldseekerSyncForeignKeys struct { + FieldseekerSyncFieldseekerSyncOrganizationIDFkey foreignKey +} + +func (f fieldseekerSyncForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FieldseekerSyncFieldseekerSyncOrganizationIDFkey, + } +} + +type fieldseekerSyncUniques struct{} + +func (u fieldseekerSyncUniques) AsSlice() []constraint { + return []constraint{} +} + +type fieldseekerSyncChecks struct{} + +func (c fieldseekerSyncChecks) AsSlice() []check { + return []check{} +} diff --git a/dbinfo/fs_containerrelate.bob.go b/dbinfo/fs_containerrelate.bob.go index aef6bb7d..74ae0d57 100644 --- a/dbinfo/fs_containerrelate.bob.go +++ b/dbinfo/fs_containerrelate.bob.go @@ -18,9 +18,9 @@ var FSContainerrelates = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_fieldscoutinglog.bob.go b/dbinfo/fs_fieldscoutinglog.bob.go index 1be9900e..099a60ed 100644 --- a/dbinfo/fs_fieldscoutinglog.bob.go +++ b/dbinfo/fs_fieldscoutinglog.bob.go @@ -18,9 +18,9 @@ var FSFieldscoutinglogs = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_habitatrelate.bob.go b/dbinfo/fs_habitatrelate.bob.go index 64de901c..72e63fea 100644 --- a/dbinfo/fs_habitatrelate.bob.go +++ b/dbinfo/fs_habitatrelate.bob.go @@ -18,9 +18,9 @@ var FSHabitatrelates = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_inspectionsample.bob.go b/dbinfo/fs_inspectionsample.bob.go index c3dec84e..059fff82 100644 --- a/dbinfo/fs_inspectionsample.bob.go +++ b/dbinfo/fs_inspectionsample.bob.go @@ -18,9 +18,9 @@ var FSInspectionsamples = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_inspectionsampledetail.bob.go b/dbinfo/fs_inspectionsampledetail.bob.go index aae3be2d..a1cded24 100644 --- a/dbinfo/fs_inspectionsampledetail.bob.go +++ b/dbinfo/fs_inspectionsampledetail.bob.go @@ -18,9 +18,9 @@ var FSInspectionsampledetails = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_linelocation.bob.go b/dbinfo/fs_linelocation.bob.go index aaee1e0b..5595a947 100644 --- a/dbinfo/fs_linelocation.bob.go +++ b/dbinfo/fs_linelocation.bob.go @@ -18,9 +18,9 @@ var FSLinelocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_locationtracking.bob.go b/dbinfo/fs_locationtracking.bob.go index 08be0eb3..a83ee1f5 100644 --- a/dbinfo/fs_locationtracking.bob.go +++ b/dbinfo/fs_locationtracking.bob.go @@ -18,9 +18,9 @@ var FSLocationtrackings = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_mosquitoinspection.bob.go b/dbinfo/fs_mosquitoinspection.bob.go index 89489a0f..66cf4a19 100644 --- a/dbinfo/fs_mosquitoinspection.bob.go +++ b/dbinfo/fs_mosquitoinspection.bob.go @@ -18,9 +18,9 @@ var FSMosquitoinspections = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_pointlocation.bob.go b/dbinfo/fs_pointlocation.bob.go index 77794756..25e762b9 100644 --- a/dbinfo/fs_pointlocation.bob.go +++ b/dbinfo/fs_pointlocation.bob.go @@ -18,9 +18,9 @@ var FSPointlocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_polygonlocation.bob.go b/dbinfo/fs_polygonlocation.bob.go index 9ff7c229..9a5ac828 100644 --- a/dbinfo/fs_polygonlocation.bob.go +++ b/dbinfo/fs_polygonlocation.bob.go @@ -18,9 +18,9 @@ var FSPolygonlocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_pool.bob.go b/dbinfo/fs_pool.bob.go index c6dd827f..71ce217d 100644 --- a/dbinfo/fs_pool.bob.go +++ b/dbinfo/fs_pool.bob.go @@ -18,9 +18,9 @@ var FSPools = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_pooldetail.bob.go b/dbinfo/fs_pooldetail.bob.go index 794474bf..ced62a47 100644 --- a/dbinfo/fs_pooldetail.bob.go +++ b/dbinfo/fs_pooldetail.bob.go @@ -18,9 +18,9 @@ var FSPooldetails = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_proposedtreatmentarea.bob.go b/dbinfo/fs_proposedtreatmentarea.bob.go index 3d79a3d4..4c9f2006 100644 --- a/dbinfo/fs_proposedtreatmentarea.bob.go +++ b/dbinfo/fs_proposedtreatmentarea.bob.go @@ -18,9 +18,9 @@ var FSProposedtreatmentareas = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_qamosquitoinspection.bob.go b/dbinfo/fs_qamosquitoinspection.bob.go index eb43a8fc..d58944b6 100644 --- a/dbinfo/fs_qamosquitoinspection.bob.go +++ b/dbinfo/fs_qamosquitoinspection.bob.go @@ -18,9 +18,9 @@ var FSQamosquitoinspections = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_rodentlocation.bob.go b/dbinfo/fs_rodentlocation.bob.go index d1228210..9dd61c3f 100644 --- a/dbinfo/fs_rodentlocation.bob.go +++ b/dbinfo/fs_rodentlocation.bob.go @@ -18,9 +18,9 @@ var FSRodentlocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_samplecollection.bob.go b/dbinfo/fs_samplecollection.bob.go index 2ac0a4f2..ebca07b5 100644 --- a/dbinfo/fs_samplecollection.bob.go +++ b/dbinfo/fs_samplecollection.bob.go @@ -18,9 +18,9 @@ var FSSamplecollections = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_samplelocation.bob.go b/dbinfo/fs_samplelocation.bob.go index 1e4b73df..888fe82b 100644 --- a/dbinfo/fs_samplelocation.bob.go +++ b/dbinfo/fs_samplelocation.bob.go @@ -18,9 +18,9 @@ var FSSamplelocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_servicerequest.bob.go b/dbinfo/fs_servicerequest.bob.go index 2f8c3c63..54445a6f 100644 --- a/dbinfo/fs_servicerequest.bob.go +++ b/dbinfo/fs_servicerequest.bob.go @@ -18,9 +18,9 @@ var FSServicerequests = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_speciesabundance.bob.go b/dbinfo/fs_speciesabundance.bob.go index 440f5f07..fb38a378 100644 --- a/dbinfo/fs_speciesabundance.bob.go +++ b/dbinfo/fs_speciesabundance.bob.go @@ -18,9 +18,9 @@ var FSSpeciesabundances = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_stormdrain.bob.go b/dbinfo/fs_stormdrain.bob.go index 824578e9..2ce8fa40 100644 --- a/dbinfo/fs_stormdrain.bob.go +++ b/dbinfo/fs_stormdrain.bob.go @@ -18,9 +18,9 @@ var FSStormdrains = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_timecard.bob.go b/dbinfo/fs_timecard.bob.go index 1d14e9f3..8395d0fe 100644 --- a/dbinfo/fs_timecard.bob.go +++ b/dbinfo/fs_timecard.bob.go @@ -18,9 +18,9 @@ var FSTimecards = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_trapdata.bob.go b/dbinfo/fs_trapdata.bob.go index fa3ab9e5..29a07a35 100644 --- a/dbinfo/fs_trapdata.bob.go +++ b/dbinfo/fs_trapdata.bob.go @@ -18,9 +18,9 @@ var FSTrapdata = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_traplocation.bob.go b/dbinfo/fs_traplocation.bob.go index b1df1a30..9c853c6c 100644 --- a/dbinfo/fs_traplocation.bob.go +++ b/dbinfo/fs_traplocation.bob.go @@ -18,9 +18,9 @@ var FSTraplocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_treatment.bob.go b/dbinfo/fs_treatment.bob.go index cd310468..01e4971b 100644 --- a/dbinfo/fs_treatment.bob.go +++ b/dbinfo/fs_treatment.bob.go @@ -18,9 +18,9 @@ var FSTreatments = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_treatmentarea.bob.go b/dbinfo/fs_treatmentarea.bob.go index 9c1aadea..80402b68 100644 --- a/dbinfo/fs_treatmentarea.bob.go +++ b/dbinfo/fs_treatmentarea.bob.go @@ -18,9 +18,9 @@ var FSTreatmentareas = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_zones.bob.go b/dbinfo/fs_zones.bob.go index 97458f4c..77ebd5b0 100644 --- a/dbinfo/fs_zones.bob.go +++ b/dbinfo/fs_zones.bob.go @@ -18,9 +18,9 @@ var FSZones = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/fs_zones2.bob.go b/dbinfo/fs_zones2.bob.go index 08e8b000..d96279e9 100644 --- a/dbinfo/fs_zones2.bob.go +++ b/dbinfo/fs_zones2.bob.go @@ -18,9 +18,9 @@ var FSZones2s = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/history_containerrelate.bob.go b/dbinfo/history_containerrelate.bob.go index 6b851a22..67c0e44a 100644 --- a/dbinfo/history_containerrelate.bob.go +++ b/dbinfo/history_containerrelate.bob.go @@ -18,9 +18,9 @@ var HistoryContainerrelates = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -114,6 +114,15 @@ var HistoryContainerrelates = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -234,6 +243,7 @@ type historyContainerrelateColumns struct { Mosquitoinspid column Objectid column Treatmentid column + Created column CreatedDate column CreatedUser column GeometryX column @@ -245,7 +255,7 @@ type historyContainerrelateColumns struct { func (c historyContainerrelateColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Inspsampleid, c.Mosquitoinspid, c.Objectid, c.Treatmentid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Inspsampleid, c.Mosquitoinspid, c.Objectid, c.Treatmentid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_fieldscoutinglog.bob.go b/dbinfo/history_fieldscoutinglog.bob.go index bb8f322d..6dd8dd63 100644 --- a/dbinfo/history_fieldscoutinglog.bob.go +++ b/dbinfo/history_fieldscoutinglog.bob.go @@ -18,9 +18,9 @@ var HistoryFieldscoutinglogs = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -87,6 +87,15 @@ var HistoryFieldscoutinglogs = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -204,6 +213,7 @@ type historyFieldscoutinglogColumns struct { Globalid column Objectid column Status column + Created column CreatedDate column CreatedUser column GeometryX column @@ -215,7 +225,7 @@ type historyFieldscoutinglogColumns struct { func (c historyFieldscoutinglogColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Objectid, c.Status, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Objectid, c.Status, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_habitatrelate.bob.go b/dbinfo/history_habitatrelate.bob.go index 1da0e98a..fce6721d 100644 --- a/dbinfo/history_habitatrelate.bob.go +++ b/dbinfo/history_habitatrelate.bob.go @@ -18,9 +18,9 @@ var HistoryHabitatrelates = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -96,6 +96,15 @@ var HistoryHabitatrelates = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -214,6 +223,7 @@ type historyHabitatrelateColumns struct { Globalid column Habitattype column Objectid column + Created column CreatedDate column CreatedUser column GeometryX column @@ -225,7 +235,7 @@ type historyHabitatrelateColumns struct { func (c historyHabitatrelateColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ForeignID, c.Globalid, c.Habitattype, c.Objectid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ForeignID, c.Globalid, c.Habitattype, c.Objectid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_inspectionsample.bob.go b/dbinfo/history_inspectionsample.bob.go index 0b89b92a..ae273e08 100644 --- a/dbinfo/history_inspectionsample.bob.go +++ b/dbinfo/history_inspectionsample.bob.go @@ -18,9 +18,9 @@ var HistoryInspectionsamples = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -114,6 +114,15 @@ var HistoryInspectionsamples = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -234,6 +243,7 @@ type historyInspectionsampleColumns struct { Objectid column Processed column Sampleid column + Created column CreatedDate column CreatedUser column GeometryX column @@ -245,7 +255,7 @@ type historyInspectionsampleColumns struct { func (c historyInspectionsampleColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Idbytech, c.InspID, c.Objectid, c.Processed, c.Sampleid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Idbytech, c.InspID, c.Objectid, c.Processed, c.Sampleid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_inspectionsampledetail.bob.go b/dbinfo/history_inspectionsampledetail.bob.go index 801d39d1..be401bc9 100644 --- a/dbinfo/history_inspectionsampledetail.bob.go +++ b/dbinfo/history_inspectionsampledetail.bob.go @@ -18,9 +18,9 @@ var HistoryInspectionsampledetails = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -213,6 +213,15 @@ var HistoryInspectionsampledetails = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -344,6 +353,7 @@ type historyInspectionsampledetailColumns struct { Lpupcount column Objectid column Processed column + Created column CreatedDate column CreatedUser column GeometryX column @@ -355,7 +365,7 @@ type historyInspectionsampledetailColumns struct { func (c historyInspectionsampledetailColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fadultact, c.Fdomstage, c.Feggcount, c.Fieldspecies, c.Flarvcount, c.Flstages, c.Fpupcount, c.Globalid, c.InspsampleID, c.Labspecies, c.Ldomstage, c.Leggcount, c.Llarvcount, c.Lpupcount, c.Objectid, c.Processed, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fadultact, c.Fdomstage, c.Feggcount, c.Fieldspecies, c.Flarvcount, c.Flstages, c.Fpupcount, c.Globalid, c.InspsampleID, c.Labspecies, c.Ldomstage, c.Leggcount, c.Llarvcount, c.Lpupcount, c.Objectid, c.Processed, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_linelocation.bob.go b/dbinfo/history_linelocation.bob.go index fa52455c..738ed468 100644 --- a/dbinfo/history_linelocation.bob.go +++ b/dbinfo/history_linelocation.bob.go @@ -18,9 +18,9 @@ var HistoryLinelocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -420,6 +420,15 @@ var HistoryLinelocations = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -574,6 +583,7 @@ type historyLinelocationColumns struct { WidthMeters column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -585,7 +595,7 @@ type historyLinelocationColumns struct { func (c historyLinelocationColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.LengthFT, c.LengthMeters, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeLength, c.Usetype, c.Waterorigin, c.WidthFT, c.WidthMeters, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.LengthFT, c.LengthMeters, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeLength, c.Usetype, c.Waterorigin, c.WidthFT, c.WidthMeters, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_locationtracking.bob.go b/dbinfo/history_locationtracking.bob.go index 3e4db938..a71d1972 100644 --- a/dbinfo/history_locationtracking.bob.go +++ b/dbinfo/history_locationtracking.bob.go @@ -18,9 +18,9 @@ var HistoryLocationtrackings = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -96,6 +96,15 @@ var HistoryLocationtrackings = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -214,6 +223,7 @@ type historyLocationtrackingColumns struct { Fieldtech column Globalid column Objectid column + Created column CreatedDate column CreatedUser column GeometryX column @@ -225,7 +235,7 @@ type historyLocationtrackingColumns struct { func (c historyLocationtrackingColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Accuracy, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Objectid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Accuracy, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Objectid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_mosquitoinspection.bob.go b/dbinfo/history_mosquitoinspection.bob.go index 0c48caa3..de4847e9 100644 --- a/dbinfo/history_mosquitoinspection.bob.go +++ b/dbinfo/history_mosquitoinspection.bob.go @@ -18,9 +18,9 @@ var HistoryMosquitoinspections = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -483,6 +483,15 @@ var HistoryMosquitoinspections = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -662,6 +671,7 @@ type historyMosquitoinspectionColumns struct { Windspeed column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -675,7 +685,7 @@ type historyMosquitoinspectionColumns struct { func (c historyMosquitoinspectionColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Actiontaken, c.Activity, c.Adultact, c.Avetemp, c.Avglarvae, c.Avgpupae, c.Breeding, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Domstage, c.Eggs, c.Enddatetime, c.Editdate, c.Editor, c.Fieldspecies, c.Fieldtech, c.Globalid, c.Jurisdiction, c.Larvaepresent, c.Linelocid, c.Locationname, c.Lstages, c.Numdips, c.Objectid, c.Personalcontact, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Positivecontainercount, c.Pupaepresent, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Tirecount, c.Totlarvae, c.Totpupae, c.Visualmonitoring, c.Vmcomments, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Adminaction, c.Ptaid, c.Version, + c.OrganizationID, c.Actiontaken, c.Activity, c.Adultact, c.Avetemp, c.Avglarvae, c.Avgpupae, c.Breeding, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Domstage, c.Eggs, c.Enddatetime, c.Editdate, c.Editor, c.Fieldspecies, c.Fieldtech, c.Globalid, c.Jurisdiction, c.Larvaepresent, c.Linelocid, c.Locationname, c.Lstages, c.Numdips, c.Objectid, c.Personalcontact, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Positivecontainercount, c.Pupaepresent, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Tirecount, c.Totlarvae, c.Totpupae, c.Visualmonitoring, c.Vmcomments, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Adminaction, c.Ptaid, c.Version, } } diff --git a/dbinfo/history_pointlocation.bob.go b/dbinfo/history_pointlocation.bob.go index 6762763f..57efe864 100644 --- a/dbinfo/history_pointlocation.bob.go +++ b/dbinfo/history_pointlocation.bob.go @@ -18,9 +18,9 @@ var HistoryPointlocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/history_polygonlocation.bob.go b/dbinfo/history_polygonlocation.bob.go index 3bc4c17b..c11ca098 100644 --- a/dbinfo/history_polygonlocation.bob.go +++ b/dbinfo/history_polygonlocation.bob.go @@ -18,9 +18,9 @@ var HistoryPolygonlocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/history_pool.bob.go b/dbinfo/history_pool.bob.go index b689dd0a..d507f7a2 100644 --- a/dbinfo/history_pool.bob.go +++ b/dbinfo/history_pool.bob.go @@ -18,9 +18,9 @@ var HistoryPools = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -213,6 +213,15 @@ var HistoryPools = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -371,6 +380,7 @@ type historyPoolColumns struct { Testmethod column Testtech column TrapdataID column + Created column CreatedDate column CreatedUser column GeometryX column @@ -385,7 +395,7 @@ type historyPoolColumns struct { func (c historyPoolColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Lab, c.LabID, c.Objectid, c.Poolyear, c.Processed, c.Sampleid, c.Survtech, c.Testmethod, c.Testtech, c.TrapdataID, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Version, + c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Lab, c.LabID, c.Objectid, c.Poolyear, c.Processed, c.Sampleid, c.Survtech, c.Testmethod, c.Testtech, c.TrapdataID, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Version, } } diff --git a/dbinfo/history_pooldetail.bob.go b/dbinfo/history_pooldetail.bob.go index d56878b3..f7fac0e1 100644 --- a/dbinfo/history_pooldetail.bob.go +++ b/dbinfo/history_pooldetail.bob.go @@ -18,9 +18,9 @@ var HistoryPooldetails = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -114,6 +114,15 @@ var HistoryPooldetails = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -234,6 +243,7 @@ type historyPooldetailColumns struct { PoolID column Species column TrapdataID column + Created column CreatedDate column CreatedUser column GeometryX column @@ -245,7 +255,7 @@ type historyPooldetailColumns struct { func (c historyPooldetailColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Females, c.Globalid, c.Objectid, c.PoolID, c.Species, c.TrapdataID, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Females, c.Globalid, c.Objectid, c.PoolID, c.Species, c.TrapdataID, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_proposedtreatmentarea.bob.go b/dbinfo/history_proposedtreatmentarea.bob.go index c172c26c..8d76ffd6 100644 --- a/dbinfo/history_proposedtreatmentarea.bob.go +++ b/dbinfo/history_proposedtreatmentarea.bob.go @@ -18,9 +18,9 @@ var HistoryProposedtreatmentareas = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/history_qamosquitoinspection.bob.go b/dbinfo/history_qamosquitoinspection.bob.go index da6d6863..4b2e1606 100644 --- a/dbinfo/history_qamosquitoinspection.bob.go +++ b/dbinfo/history_qamosquitoinspection.bob.go @@ -18,9 +18,9 @@ var HistoryQamosquitoinspections = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -546,6 +546,15 @@ var HistoryQamosquitoinspections = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -714,6 +723,7 @@ type historyQamosquitoinspectionColumns struct { Windspeed column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -725,7 +735,7 @@ type historyQamosquitoinspectionColumns struct { func (c historyQamosquitoinspectionColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Acresbreeding, c.Actiontaken, c.Adultactivity, c.Aquaticorganisms, c.Avetemp, c.Breedingpotential, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Fish, c.Globalid, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaepresent, c.Larvaereason, c.Linelocid, c.Locationname, c.LR, c.Mosquitohabitat, c.Movingwater, c.Negdips, c.Nowaterever, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Potential, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitetype, c.Soilconditions, c.Sourcereduction, c.Startdatetime, c.Totalacres, c.Vegetation, c.Waterconditions, c.Waterduration, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Waterpresent, c.Watersource, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Acresbreeding, c.Actiontaken, c.Adultactivity, c.Aquaticorganisms, c.Avetemp, c.Breedingpotential, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Fish, c.Globalid, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaepresent, c.Larvaereason, c.Linelocid, c.Locationname, c.LR, c.Mosquitohabitat, c.Movingwater, c.Negdips, c.Nowaterever, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Potential, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitetype, c.Soilconditions, c.Sourcereduction, c.Startdatetime, c.Totalacres, c.Vegetation, c.Waterconditions, c.Waterduration, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Waterpresent, c.Watersource, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_rodentlocation.bob.go b/dbinfo/history_rodentlocation.bob.go index d1ccba23..5e2f1c56 100644 --- a/dbinfo/history_rodentlocation.bob.go +++ b/dbinfo/history_rodentlocation.bob.go @@ -18,9 +18,9 @@ var HistoryRodentlocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -249,6 +249,15 @@ var HistoryRodentlocations = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -393,6 +402,7 @@ type historyRodentlocationColumns struct { Usetype column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -405,7 +415,7 @@ type historyRodentlocationColumns struct { func (c historyRodentlocationColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectrodentevidence, c.Lastinspectspecies, c.Locationname, c.Locationnumber, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Jurisdiction, c.Version, + c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectrodentevidence, c.Lastinspectspecies, c.Locationname, c.Locationnumber, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Jurisdiction, c.Version, } } diff --git a/dbinfo/history_samplecollection.bob.go b/dbinfo/history_samplecollection.bob.go index fdbdda5b..7dd10855 100644 --- a/dbinfo/history_samplecollection.bob.go +++ b/dbinfo/history_samplecollection.bob.go @@ -18,9 +18,9 @@ var HistorySamplecollections = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -402,6 +402,15 @@ var HistorySamplecollections = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -554,6 +563,7 @@ type historySamplecollectionColumns struct { Windspeed column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -565,7 +575,7 @@ type historySamplecollectionColumns struct { func (c historySamplecollectionColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Activity, c.Avetemp, c.Chickenid, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Flockid, c.Gatewaysync, c.Globalid, c.Lab, c.Locationname, c.LocID, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Samplecond, c.Samplecount, c.Sampleid, c.Sampletype, c.Sex, c.Sitecond, c.Species, c.Startdatetime, c.Survtech, c.Testmethod, c.Testtech, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Activity, c.Avetemp, c.Chickenid, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Flockid, c.Gatewaysync, c.Globalid, c.Lab, c.Locationname, c.LocID, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Samplecond, c.Samplecount, c.Sampleid, c.Sampletype, c.Sex, c.Sitecond, c.Species, c.Startdatetime, c.Survtech, c.Testmethod, c.Testtech, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_samplelocation.bob.go b/dbinfo/history_samplelocation.bob.go index 7509e5e7..818ea356 100644 --- a/dbinfo/history_samplelocation.bob.go +++ b/dbinfo/history_samplelocation.bob.go @@ -18,9 +18,9 @@ var HistorySamplelocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -204,6 +204,15 @@ var HistorySamplelocations = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -334,6 +343,7 @@ type historySamplelocationColumns struct { Usetype column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -345,7 +355,7 @@ type historySamplelocationColumns struct { func (c historySamplelocationColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_servicerequest.bob.go b/dbinfo/history_servicerequest.bob.go index e6b32c53..6b4148c1 100644 --- a/dbinfo/history_servicerequest.bob.go +++ b/dbinfo/history_servicerequest.bob.go @@ -18,9 +18,9 @@ var HistoryServicerequests = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -726,6 +726,15 @@ var HistoryServicerequests = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -950,6 +959,7 @@ type historyServicerequestColumns struct { Yvalue column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -965,7 +975,7 @@ type historyServicerequestColumns struct { func (c historyServicerequestColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Accepted, c.Acceptedby, c.Accepteddate, c.Allowed, c.Assignedtech, c.Clraddr1, c.Clraddr2, c.Clranon, c.Clrcity, c.Clrcompany, c.Clrcontpref, c.Clremail, c.Clrfname, c.Clrother, c.Clrphone1, c.Clrphone2, c.Clrstate, c.Clrzip, c.Comments, c.Creationdate, c.Creator, c.Datetimeclosed, c.Duedate, c.Entrytech, c.Estcompletedate, c.Externalerror, c.Externalid, c.Editdate, c.Editor, c.Firstresponsedate, c.Globalid, c.Issuesreported, c.Jurisdiction, c.Nextaction, c.Notificationtimestamp, c.Notified, c.Notifieddate, c.Objectid, c.Pointlocid, c.Priority, c.Recdatetime, c.Recordstatus, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqcompany, c.Reqcrossst, c.Reqdescr, c.Reqfldnotes, c.Reqmapgrid, c.Reqnotesforcust, c.Reqnotesfortech, c.Reqpermission, c.Reqprogramactions, c.Reqstate, c.Reqsubdiv, c.Reqtarget, c.Reqzip, c.Responsedaycount, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Scheduled, c.Scheduleddate, c.Source, c.SRNumber, c.Status, c.Supervisor, c.Techclosed, c.Validx, c.Validy, c.Xvalue, c.Yvalue, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Dog, c.Spanish, c.ScheduleNotes, c.SchedulePeriod, c.Version, + c.OrganizationID, c.Accepted, c.Acceptedby, c.Accepteddate, c.Allowed, c.Assignedtech, c.Clraddr1, c.Clraddr2, c.Clranon, c.Clrcity, c.Clrcompany, c.Clrcontpref, c.Clremail, c.Clrfname, c.Clrother, c.Clrphone1, c.Clrphone2, c.Clrstate, c.Clrzip, c.Comments, c.Creationdate, c.Creator, c.Datetimeclosed, c.Duedate, c.Entrytech, c.Estcompletedate, c.Externalerror, c.Externalid, c.Editdate, c.Editor, c.Firstresponsedate, c.Globalid, c.Issuesreported, c.Jurisdiction, c.Nextaction, c.Notificationtimestamp, c.Notified, c.Notifieddate, c.Objectid, c.Pointlocid, c.Priority, c.Recdatetime, c.Recordstatus, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqcompany, c.Reqcrossst, c.Reqdescr, c.Reqfldnotes, c.Reqmapgrid, c.Reqnotesforcust, c.Reqnotesfortech, c.Reqpermission, c.Reqprogramactions, c.Reqstate, c.Reqsubdiv, c.Reqtarget, c.Reqzip, c.Responsedaycount, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Scheduled, c.Scheduleddate, c.Source, c.SRNumber, c.Status, c.Supervisor, c.Techclosed, c.Validx, c.Validy, c.Xvalue, c.Yvalue, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Dog, c.Spanish, c.ScheduleNotes, c.SchedulePeriod, c.Version, } } diff --git a/dbinfo/history_speciesabundance.bob.go b/dbinfo/history_speciesabundance.bob.go index 3c1e302f..9f46221c 100644 --- a/dbinfo/history_speciesabundance.bob.go +++ b/dbinfo/history_speciesabundance.bob.go @@ -18,9 +18,9 @@ var HistorySpeciesabundances = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -195,6 +195,15 @@ var HistorySpeciesabundances = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -378,6 +387,7 @@ type historySpeciesabundanceColumns struct { Total column TrapdataID column Unknown column + Created column CreatedDate column CreatedUser column GeometryX column @@ -395,7 +405,7 @@ type historySpeciesabundanceColumns struct { func (c historySpeciesabundanceColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Bloodedfem, c.Creationdate, c.Creator, c.Eggs, c.Editdate, c.Editor, c.Females, c.Gravidfem, c.Globalid, c.Larvae, c.Males, c.Objectid, c.Poolstogen, c.Processed, c.Pupae, c.Species, c.Total, c.TrapdataID, c.Unknown, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Globalzscore, c.H3R7, c.H3R8, c.R7score, c.R8score, c.Yearweek, c.Version, + c.OrganizationID, c.Bloodedfem, c.Creationdate, c.Creator, c.Eggs, c.Editdate, c.Editor, c.Females, c.Gravidfem, c.Globalid, c.Larvae, c.Males, c.Objectid, c.Poolstogen, c.Processed, c.Pupae, c.Species, c.Total, c.TrapdataID, c.Unknown, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Globalzscore, c.H3R7, c.H3R8, c.R7score, c.R8score, c.Yearweek, c.Version, } } diff --git a/dbinfo/history_stormdrain.bob.go b/dbinfo/history_stormdrain.bob.go index e3daae69..b46ad30b 100644 --- a/dbinfo/history_stormdrain.bob.go +++ b/dbinfo/history_stormdrain.bob.go @@ -18,9 +18,9 @@ var HistoryStormdrains = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -159,6 +159,15 @@ var HistoryStormdrains = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -284,6 +293,7 @@ type historyStormdrainColumns struct { Type column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -295,7 +305,7 @@ type historyStormdrainColumns struct { func (c historyStormdrainColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Jurisdiction, c.Lastaction, c.Laststatus, c.Lasttreatdate, c.Nexttreatmentdate, c.Objectid, c.Symbology, c.Type, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Jurisdiction, c.Lastaction, c.Laststatus, c.Lasttreatdate, c.Nexttreatmentdate, c.Objectid, c.Symbology, c.Type, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_timecard.bob.go b/dbinfo/history_timecard.bob.go index 7758bf48..7a12f222 100644 --- a/dbinfo/history_timecard.bob.go +++ b/dbinfo/history_timecard.bob.go @@ -18,9 +18,9 @@ var HistoryTimecards = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -231,6 +231,15 @@ var HistoryTimecards = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -373,6 +382,7 @@ type historyTimecardColumns struct { Traplocid column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -385,7 +395,7 @@ type historyTimecardColumns struct { func (c historyTimecardColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Activity, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Externalid, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Lclocid, c.Linelocid, c.Locationname, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Samplelocid, c.Srid, c.Startdatetime, c.Traplocid, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Rodentlocid, c.Version, + c.OrganizationID, c.Activity, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Externalid, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Lclocid, c.Linelocid, c.Locationname, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Samplelocid, c.Srid, c.Startdatetime, c.Traplocid, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Rodentlocid, c.Version, } } diff --git a/dbinfo/history_trapdata.bob.go b/dbinfo/history_trapdata.bob.go index 47cdf577..fbf57aeb 100644 --- a/dbinfo/history_trapdata.bob.go +++ b/dbinfo/history_trapdata.bob.go @@ -18,9 +18,9 @@ var HistoryTrapdata = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -339,6 +339,15 @@ var HistoryTrapdata = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -511,6 +520,7 @@ type historyTrapdatumColumns struct { Windspeed column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -525,7 +535,7 @@ type historyTrapdatumColumns struct { func (c historyTrapdatumColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Avetemp, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Field, c.Gatewaysync, c.Globalid, c.Idbytech, c.Locationname, c.LocID, c.LR, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitecond, c.Sortbytech, c.Srid, c.Startdatetime, c.Trapactivitytype, c.Trapcondition, c.Trapnights, c.Traptype, c.Voltage, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Lure, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Version, + c.OrganizationID, c.Avetemp, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Field, c.Gatewaysync, c.Globalid, c.Idbytech, c.Locationname, c.LocID, c.LR, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitecond, c.Sortbytech, c.Srid, c.Startdatetime, c.Trapactivitytype, c.Trapcondition, c.Trapnights, c.Traptype, c.Voltage, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Lure, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Version, } } diff --git a/dbinfo/history_traplocation.bob.go b/dbinfo/history_traplocation.bob.go index 28e6f061..a8cff6f7 100644 --- a/dbinfo/history_traplocation.bob.go +++ b/dbinfo/history_traplocation.bob.go @@ -18,9 +18,9 @@ var HistoryTraplocations = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -204,6 +204,15 @@ var HistoryTraplocations = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -388,6 +397,7 @@ type historyTraplocationColumns struct { Usetype column Zone column Zone2 column + Created column CreatedDate column CreatedUser column GeometryX column @@ -405,7 +415,7 @@ type historyTraplocationColumns struct { func (c historyTraplocationColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Route, c.RouteOrder, c.SetDow, c.Vectorsurvsiteid, c.H3R7, c.H3R8, c.Version, + c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Route, c.RouteOrder, c.SetDow, c.Vectorsurvsiteid, c.H3R7, c.H3R8, c.Version, } } diff --git a/dbinfo/history_treatment.bob.go b/dbinfo/history_treatment.bob.go index 8e8d9a07..a4046457 100644 --- a/dbinfo/history_treatment.bob.go +++ b/dbinfo/history_treatment.bob.go @@ -18,9 +18,9 @@ var HistoryTreatments = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, diff --git a/dbinfo/history_treatmentarea.bob.go b/dbinfo/history_treatmentarea.bob.go index 85adf81a..48ebd752 100644 --- a/dbinfo/history_treatmentarea.bob.go +++ b/dbinfo/history_treatmentarea.bob.go @@ -18,9 +18,9 @@ var HistoryTreatmentareas = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -150,6 +150,15 @@ var HistoryTreatmentareas = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -274,6 +283,7 @@ type historyTreatmentareaColumns struct { Treatdate column TreatID column Type column + Created column CreatedDate column CreatedUser column GeometryX column @@ -285,7 +295,7 @@ type historyTreatmentareaColumns struct { func (c historyTreatmentareaColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Notified, c.Objectid, c.SessionID, c.ShapeArea, c.ShapeLength, c.Treatdate, c.TreatID, c.Type, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Notified, c.Objectid, c.SessionID, c.ShapeArea, c.ShapeLength, c.Treatdate, c.TreatID, c.Type, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_zones.bob.go b/dbinfo/history_zones.bob.go index be4645d4..0a8baaf3 100644 --- a/dbinfo/history_zones.bob.go +++ b/dbinfo/history_zones.bob.go @@ -18,9 +18,9 @@ var HistoryZones = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -114,6 +114,15 @@ var HistoryZones = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -234,6 +243,7 @@ type historyZoneColumns struct { Objectid column ShapeArea column ShapeLength column + Created column CreatedDate column CreatedUser column GeometryX column @@ -245,7 +255,7 @@ type historyZoneColumns struct { func (c historyZoneColumns) AsSlice() []column { return []column{ - c.OrganizationID, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/dbinfo/history_zones2.bob.go b/dbinfo/history_zones2.bob.go index 6bc11e39..41cf67a4 100644 --- a/dbinfo/history_zones2.bob.go +++ b/dbinfo/history_zones2.bob.go @@ -18,9 +18,9 @@ var HistoryZones2s = Table[ OrganizationID: column{ Name: "organization_id", DBType: "integer", - Default: "NULL", + Default: "", Comment: "", - Nullable: true, + Nullable: false, Generated: false, AutoIncr: false, }, @@ -105,6 +105,15 @@ var HistoryZones2s = Table[ Generated: false, AutoIncr: false, }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, CreatedDate: column{ Name: "created_date", DBType: "bigint", @@ -224,6 +233,7 @@ type historyZones2Columns struct { Objectid column ShapeArea column ShapeLength column + Created column CreatedDate column CreatedUser column GeometryX column @@ -235,7 +245,7 @@ type historyZones2Columns struct { func (c historyZones2Columns) AsSlice() []column { return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, + c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, } } diff --git a/factory/bobfactory_context.bob.go b/factory/bobfactory_context.bob.go index 4787aaab..7a657129 100644 --- a/factory/bobfactory_context.bob.go +++ b/factory/bobfactory_context.bob.go @@ -8,6 +8,10 @@ import "context" type contextKey string var ( + // Relationship Contexts for fieldseeker_sync + fieldseekerSyncWithParentsCascadingCtx = newContextual[bool]("fieldseekerSyncWithParentsCascading") + fieldseekerSyncRelOrganizationCtx = newContextual[bool]("fieldseeker_sync.organization.fieldseeker_sync.fieldseeker_sync_organization_id_fkey") + // Relationship Contexts for fs_containerrelate fsContainerrelateWithParentsCascadingCtx = newContextual[bool]("fsContainerrelateWithParentsCascading") fsContainerrelateRelOrganizationCtx = newContextual[bool]("fs_containerrelate.organization.fs_containerrelate.fs_containerrelate_organization_id_fkey") @@ -233,6 +237,7 @@ var ( // Relationship Contexts for organization organizationWithParentsCascadingCtx = newContextual[bool]("organizationWithParentsCascading") + organizationRelFieldseekerSyncsCtx = newContextual[bool]("fieldseeker_sync.organization.fieldseeker_sync.fieldseeker_sync_organization_id_fkey") organizationRelFSContainerrelatesCtx = newContextual[bool]("fs_containerrelate.organization.fs_containerrelate.fs_containerrelate_organization_id_fkey") organizationRelFSFieldscoutinglogsCtx = newContextual[bool]("fs_fieldscoutinglog.organization.fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey") organizationRelFSHabitatrelatesCtx = newContextual[bool]("fs_habitatrelate.organization.fs_habitatrelate.fs_habitatrelate_organization_id_fkey") diff --git a/factory/bobfactory_main.bob.go b/factory/bobfactory_main.bob.go index 3c91784d..1d559af4 100644 --- a/factory/bobfactory_main.bob.go +++ b/factory/bobfactory_main.bob.go @@ -13,6 +13,7 @@ import ( ) type Factory struct { + baseFieldseekerSyncMods FieldseekerSyncModSlice baseFSContainerrelateMods FSContainerrelateModSlice baseFSFieldscoutinglogMods FSFieldscoutinglogModSlice baseFSHabitatrelateMods FSHabitatrelateModSlice @@ -78,6 +79,40 @@ func New() *Factory { return &Factory{} } +func (f *Factory) NewFieldseekerSync(mods ...FieldseekerSyncMod) *FieldseekerSyncTemplate { + return f.NewFieldseekerSyncWithContext(context.Background(), mods...) +} + +func (f *Factory) NewFieldseekerSyncWithContext(ctx context.Context, mods ...FieldseekerSyncMod) *FieldseekerSyncTemplate { + o := &FieldseekerSyncTemplate{f: f} + + if f != nil { + f.baseFieldseekerSyncMods.Apply(ctx, o) + } + + FieldseekerSyncModSlice(mods).Apply(ctx, o) + + return o +} + +func (f *Factory) FromExistingFieldseekerSync(m *models.FieldseekerSync) *FieldseekerSyncTemplate { + o := &FieldseekerSyncTemplate{f: f, alreadyPersisted: true} + + o.ID = func() int32 { return m.ID } + o.Created = func() time.Time { return m.Created } + o.RecordsCreated = func() int32 { return m.RecordsCreated } + o.RecordsUpdated = func() int32 { return m.RecordsUpdated } + o.RecordsUnchanged = func() int32 { return m.RecordsUnchanged } + o.OrganizationID = func() int32 { return m.OrganizationID } + + ctx := context.Background() + if m.R.Organization != nil { + FieldseekerSyncMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + + return o +} + func (f *Factory) NewFSContainerrelate(mods ...FSContainerrelateMod) *FSContainerrelateTemplate { return f.NewFSContainerrelateWithContext(context.Background(), mods...) } @@ -97,7 +132,7 @@ func (f *Factory) NewFSContainerrelateWithContext(ctx context.Context, mods ...F func (f *Factory) FromExistingFSContainerrelate(m *models.FSContainerrelate) *FSContainerrelateTemplate { o := &FSContainerrelateTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Containertype = func() null.Val[string] { return m.Containertype } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -143,7 +178,7 @@ func (f *Factory) NewFSFieldscoutinglogWithContext(ctx context.Context, mods ... func (f *Factory) FromExistingFSFieldscoutinglog(m *models.FSFieldscoutinglog) *FSFieldscoutinglogTemplate { o := &FSFieldscoutinglogTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -186,7 +221,7 @@ func (f *Factory) NewFSHabitatrelateWithContext(ctx context.Context, mods ...FSH func (f *Factory) FromExistingFSHabitatrelate(m *models.FSHabitatrelate) *FSHabitatrelateTemplate { o := &FSHabitatrelateTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -230,7 +265,7 @@ func (f *Factory) NewFSInspectionsampleWithContext(ctx context.Context, mods ... func (f *Factory) FromExistingFSInspectionsample(m *models.FSInspectionsample) *FSInspectionsampleTemplate { o := &FSInspectionsampleTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -276,7 +311,7 @@ func (f *Factory) NewFSInspectionsampledetailWithContext(ctx context.Context, mo func (f *Factory) FromExistingFSInspectionsampledetail(m *models.FSInspectionsampledetail) *FSInspectionsampledetailTemplate { o := &FSInspectionsampledetailTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -333,7 +368,7 @@ func (f *Factory) NewFSLinelocationWithContext(ctx context.Context, mods ...FSLi func (f *Factory) FromExistingFSLinelocation(m *models.FSLinelocation) *FSLinelocationTemplate { o := &FSLinelocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Acres = func() null.Val[float64] { return m.Acres } o.Active = func() null.Val[int16] { return m.Active } @@ -413,7 +448,7 @@ func (f *Factory) NewFSLocationtrackingWithContext(ctx context.Context, mods ... func (f *Factory) FromExistingFSLocationtracking(m *models.FSLocationtracking) *FSLocationtrackingTemplate { o := &FSLocationtrackingTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accuracy = func() null.Val[float64] { return m.Accuracy } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -457,7 +492,7 @@ func (f *Factory) NewFSMosquitoinspectionWithContext(ctx context.Context, mods . func (f *Factory) FromExistingFSMosquitoinspection(m *models.FSMosquitoinspection) *FSMosquitoinspectionTemplate { o := &FSMosquitoinspectionTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Actiontaken = func() null.Val[string] { return m.Actiontaken } o.Activity = func() null.Val[string] { return m.Activity } o.Adultact = func() null.Val[string] { return m.Adultact } @@ -546,7 +581,7 @@ func (f *Factory) NewFSPointlocationWithContext(ctx context.Context, mods ...FSP func (f *Factory) FromExistingFSPointlocation(m *models.FSPointlocation) *FSPointlocationTemplate { o := &FSPointlocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -622,7 +657,7 @@ func (f *Factory) NewFSPolygonlocationWithContext(ctx context.Context, mods ...F func (f *Factory) FromExistingFSPolygonlocation(m *models.FSPolygonlocation) *FSPolygonlocationTemplate { o := &FSPolygonlocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Acres = func() null.Val[float64] { return m.Acres } o.Active = func() null.Val[int16] { return m.Active } @@ -696,7 +731,7 @@ func (f *Factory) NewFSPoolWithContext(ctx context.Context, mods ...FSPoolMod) * func (f *Factory) FromExistingFSPool(m *models.FSPool) *FSPoolTemplate { o := &FSPoolTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -756,7 +791,7 @@ func (f *Factory) NewFSPooldetailWithContext(ctx context.Context, mods ...FSPool func (f *Factory) FromExistingFSPooldetail(m *models.FSPooldetail) *FSPooldetailTemplate { o := &FSPooldetailTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -802,7 +837,7 @@ func (f *Factory) NewFSProposedtreatmentareaWithContext(ctx context.Context, mod func (f *Factory) FromExistingFSProposedtreatmentarea(m *models.FSProposedtreatmentarea) *FSProposedtreatmentareaTemplate { o := &FSProposedtreatmentareaTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Acres = func() null.Val[float64] { return m.Acres } o.Comments = func() null.Val[string] { return m.Comments } o.Completed = func() null.Val[int16] { return m.Completed } @@ -867,7 +902,7 @@ func (f *Factory) NewFSQamosquitoinspectionWithContext(ctx context.Context, mods func (f *Factory) FromExistingFSQamosquitoinspection(m *models.FSQamosquitoinspection) *FSQamosquitoinspectionTemplate { o := &FSQamosquitoinspectionTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Acresbreeding = func() null.Val[float64] { return m.Acresbreeding } o.Actiontaken = func() null.Val[string] { return m.Actiontaken } o.Adultactivity = func() null.Val[int16] { return m.Adultactivity } @@ -961,7 +996,7 @@ func (f *Factory) NewFSRodentlocationWithContext(ctx context.Context, mods ...FS func (f *Factory) FromExistingFSRodentlocation(m *models.FSRodentlocation) *FSRodentlocationTemplate { o := &FSRodentlocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -1023,7 +1058,7 @@ func (f *Factory) NewFSSamplecollectionWithContext(ctx context.Context, mods ... func (f *Factory) FromExistingFSSamplecollection(m *models.FSSamplecollection) *FSSamplecollectionTemplate { o := &FSSamplecollectionTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Activity = func() null.Val[string] { return m.Activity } o.Avetemp = func() null.Val[float64] { return m.Avetemp } o.Chickenid = func() null.Val[string] { return m.Chickenid } @@ -1101,7 +1136,7 @@ func (f *Factory) NewFSSamplelocationWithContext(ctx context.Context, mods ...FS func (f *Factory) FromExistingFSSamplelocation(m *models.FSSamplelocation) *FSSamplelocationTemplate { o := &FSSamplelocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -1157,7 +1192,7 @@ func (f *Factory) NewFSServicerequestWithContext(ctx context.Context, mods ...FS func (f *Factory) FromExistingFSServicerequest(m *models.FSServicerequest) *FSServicerequestTemplate { o := &FSServicerequestTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accepted = func() null.Val[int16] { return m.Accepted } o.Acceptedby = func() null.Val[string] { return m.Acceptedby } o.Accepteddate = func() null.Val[int64] { return m.Accepteddate } @@ -1275,7 +1310,7 @@ func (f *Factory) NewFSSpeciesabundanceWithContext(ctx context.Context, mods ... func (f *Factory) FromExistingFSSpeciesabundance(m *models.FSSpeciesabundance) *FSSpeciesabundanceTemplate { o := &FSSpeciesabundanceTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Bloodedfem = func() null.Val[int16] { return m.Bloodedfem } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -1336,7 +1371,7 @@ func (f *Factory) NewFSStormdrainWithContext(ctx context.Context, mods ...FSStor func (f *Factory) FromExistingFSStormdrain(m *models.FSStormdrain) *FSStormdrainTemplate { o := &FSStormdrainTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -1387,7 +1422,7 @@ func (f *Factory) NewFSTimecardWithContext(ctx context.Context, mods ...FSTimeca func (f *Factory) FromExistingFSTimecard(m *models.FSTimecard) *FSTimecardTemplate { o := &FSTimecardTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Activity = func() null.Val[string] { return m.Activity } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } @@ -1447,7 +1482,7 @@ func (f *Factory) NewFSTrapdatumWithContext(ctx context.Context, mods ...FSTrapd func (f *Factory) FromExistingFSTrapdatum(m *models.FSTrapdatum) *FSTrapdatumTemplate { o := &FSTrapdatumTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Avetemp = func() null.Val[float64] { return m.Avetemp } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } @@ -1521,7 +1556,7 @@ func (f *Factory) NewFSTraplocationWithContext(ctx context.Context, mods ...FSTr func (f *Factory) FromExistingFSTraplocation(m *models.FSTraplocation) *FSTraplocationTemplate { o := &FSTraplocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -1583,7 +1618,7 @@ func (f *Factory) NewFSTreatmentWithContext(ctx context.Context, mods ...FSTreat func (f *Factory) FromExistingFSTreatment(m *models.FSTreatment) *FSTreatmentTemplate { o := &FSTreatmentTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Activity = func() null.Val[string] { return m.Activity } o.Areaunit = func() null.Val[string] { return m.Areaunit } o.Avetemp = func() null.Val[float64] { return m.Avetemp } @@ -1669,7 +1704,7 @@ func (f *Factory) NewFSTreatmentareaWithContext(ctx context.Context, mods ...FST func (f *Factory) FromExistingFSTreatmentarea(m *models.FSTreatmentarea) *FSTreatmentareaTemplate { o := &FSTreatmentareaTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -1719,7 +1754,7 @@ func (f *Factory) NewFSZoneWithContext(ctx context.Context, mods ...FSZoneMod) * func (f *Factory) FromExistingFSZone(m *models.FSZone) *FSZoneTemplate { o := &FSZoneTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Active = func() null.Val[int64] { return m.Active } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -1765,7 +1800,7 @@ func (f *Factory) NewFSZones2WithContext(ctx context.Context, mods ...FSZones2Mo func (f *Factory) FromExistingFSZones2(m *models.FSZones2) *FSZones2Template { o := &FSZones2Template{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -1837,7 +1872,7 @@ func (f *Factory) NewHistoryContainerrelateWithContext(ctx context.Context, mods func (f *Factory) FromExistingHistoryContainerrelate(m *models.HistoryContainerrelate) *HistoryContainerrelateTemplate { o := &HistoryContainerrelateTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Containertype = func() null.Val[string] { return m.Containertype } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -1848,6 +1883,7 @@ func (f *Factory) FromExistingHistoryContainerrelate(m *models.HistoryContainerr o.Mosquitoinspid = func() null.Val[string] { return m.Mosquitoinspid } o.Objectid = func() int32 { return m.Objectid } o.Treatmentid = func() null.Val[string] { return m.Treatmentid } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -1883,7 +1919,7 @@ func (f *Factory) NewHistoryFieldscoutinglogWithContext(ctx context.Context, mod func (f *Factory) FromExistingHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglog) *HistoryFieldscoutinglogTemplate { o := &HistoryFieldscoutinglogTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -1891,6 +1927,7 @@ func (f *Factory) FromExistingHistoryFieldscoutinglog(m *models.HistoryFieldscou o.Globalid = func() null.Val[string] { return m.Globalid } o.Objectid = func() int32 { return m.Objectid } o.Status = func() null.Val[int16] { return m.Status } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -1926,7 +1963,7 @@ func (f *Factory) NewHistoryHabitatrelateWithContext(ctx context.Context, mods . func (f *Factory) FromExistingHistoryHabitatrelate(m *models.HistoryHabitatrelate) *HistoryHabitatrelateTemplate { o := &HistoryHabitatrelateTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -1935,6 +1972,7 @@ func (f *Factory) FromExistingHistoryHabitatrelate(m *models.HistoryHabitatrelat o.Globalid = func() null.Val[string] { return m.Globalid } o.Habitattype = func() null.Val[string] { return m.Habitattype } o.Objectid = func() int32 { return m.Objectid } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -1970,7 +2008,7 @@ func (f *Factory) NewHistoryInspectionsampleWithContext(ctx context.Context, mod func (f *Factory) FromExistingHistoryInspectionsample(m *models.HistoryInspectionsample) *HistoryInspectionsampleTemplate { o := &HistoryInspectionsampleTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -1981,6 +2019,7 @@ func (f *Factory) FromExistingHistoryInspectionsample(m *models.HistoryInspectio o.Objectid = func() int32 { return m.Objectid } o.Processed = func() null.Val[int16] { return m.Processed } o.Sampleid = func() null.Val[string] { return m.Sampleid } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2016,7 +2055,7 @@ func (f *Factory) NewHistoryInspectionsampledetailWithContext(ctx context.Contex func (f *Factory) FromExistingHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetail) *HistoryInspectionsampledetailTemplate { o := &HistoryInspectionsampledetailTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -2038,6 +2077,7 @@ func (f *Factory) FromExistingHistoryInspectionsampledetail(m *models.HistoryIns o.Lpupcount = func() null.Val[int16] { return m.Lpupcount } o.Objectid = func() int32 { return m.Objectid } o.Processed = func() null.Val[int16] { return m.Processed } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2073,7 +2113,7 @@ func (f *Factory) NewHistoryLinelocationWithContext(ctx context.Context, mods .. func (f *Factory) FromExistingHistoryLinelocation(m *models.HistoryLinelocation) *HistoryLinelocationTemplate { o := &HistoryLinelocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Acres = func() null.Val[float64] { return m.Acres } o.Active = func() null.Val[int16] { return m.Active } @@ -2118,6 +2158,7 @@ func (f *Factory) FromExistingHistoryLinelocation(m *models.HistoryLinelocation) o.WidthMeters = func() null.Val[float64] { return m.WidthMeters } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2153,7 +2194,7 @@ func (f *Factory) NewHistoryLocationtrackingWithContext(ctx context.Context, mod func (f *Factory) FromExistingHistoryLocationtracking(m *models.HistoryLocationtracking) *HistoryLocationtrackingTemplate { o := &HistoryLocationtrackingTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accuracy = func() null.Val[float64] { return m.Accuracy } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -2162,6 +2203,7 @@ func (f *Factory) FromExistingHistoryLocationtracking(m *models.HistoryLocationt o.Fieldtech = func() null.Val[string] { return m.Fieldtech } o.Globalid = func() null.Val[string] { return m.Globalid } o.Objectid = func() int32 { return m.Objectid } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2197,7 +2239,7 @@ func (f *Factory) NewHistoryMosquitoinspectionWithContext(ctx context.Context, m func (f *Factory) FromExistingHistoryMosquitoinspection(m *models.HistoryMosquitoinspection) *HistoryMosquitoinspectionTemplate { o := &HistoryMosquitoinspectionTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Actiontaken = func() null.Val[string] { return m.Actiontaken } o.Activity = func() null.Val[string] { return m.Activity } o.Adultact = func() null.Val[string] { return m.Adultact } @@ -2249,6 +2291,7 @@ func (f *Factory) FromExistingHistoryMosquitoinspection(m *models.HistoryMosquit o.Windspeed = func() null.Val[float64] { return m.Windspeed } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2286,7 +2329,7 @@ func (f *Factory) NewHistoryPointlocationWithContext(ctx context.Context, mods . func (f *Factory) FromExistingHistoryPointlocation(m *models.HistoryPointlocation) *HistoryPointlocationTemplate { o := &HistoryPointlocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -2362,7 +2405,7 @@ func (f *Factory) NewHistoryPolygonlocationWithContext(ctx context.Context, mods func (f *Factory) FromExistingHistoryPolygonlocation(m *models.HistoryPolygonlocation) *HistoryPolygonlocationTemplate { o := &HistoryPolygonlocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Acres = func() null.Val[float64] { return m.Acres } o.Active = func() null.Val[int16] { return m.Active } @@ -2436,7 +2479,7 @@ func (f *Factory) NewHistoryPoolWithContext(ctx context.Context, mods ...History func (f *Factory) FromExistingHistoryPool(m *models.HistoryPool) *HistoryPoolTemplate { o := &HistoryPoolTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -2458,6 +2501,7 @@ func (f *Factory) FromExistingHistoryPool(m *models.HistoryPool) *HistoryPoolTem o.Testmethod = func() null.Val[string] { return m.Testmethod } o.Testtech = func() null.Val[string] { return m.Testtech } o.TrapdataID = func() null.Val[string] { return m.TrapdataID } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2496,7 +2540,7 @@ func (f *Factory) NewHistoryPooldetailWithContext(ctx context.Context, mods ...H func (f *Factory) FromExistingHistoryPooldetail(m *models.HistoryPooldetail) *HistoryPooldetailTemplate { o := &HistoryPooldetailTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -2507,6 +2551,7 @@ func (f *Factory) FromExistingHistoryPooldetail(m *models.HistoryPooldetail) *Hi o.PoolID = func() null.Val[string] { return m.PoolID } o.Species = func() null.Val[string] { return m.Species } o.TrapdataID = func() null.Val[string] { return m.TrapdataID } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2542,7 +2587,7 @@ func (f *Factory) NewHistoryProposedtreatmentareaWithContext(ctx context.Context func (f *Factory) FromExistingHistoryProposedtreatmentarea(m *models.HistoryProposedtreatmentarea) *HistoryProposedtreatmentareaTemplate { o := &HistoryProposedtreatmentareaTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Acres = func() null.Val[float64] { return m.Acres } o.Comments = func() null.Val[string] { return m.Comments } o.Completed = func() null.Val[int16] { return m.Completed } @@ -2607,7 +2652,7 @@ func (f *Factory) NewHistoryQamosquitoinspectionWithContext(ctx context.Context, func (f *Factory) FromExistingHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspection) *HistoryQamosquitoinspectionTemplate { o := &HistoryQamosquitoinspectionTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Acresbreeding = func() null.Val[float64] { return m.Acresbreeding } o.Actiontaken = func() null.Val[string] { return m.Actiontaken } o.Adultactivity = func() null.Val[int16] { return m.Adultactivity } @@ -2666,6 +2711,7 @@ func (f *Factory) FromExistingHistoryQamosquitoinspection(m *models.HistoryQamos o.Windspeed = func() null.Val[float64] { return m.Windspeed } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2701,7 +2747,7 @@ func (f *Factory) NewHistoryRodentlocationWithContext(ctx context.Context, mods func (f *Factory) FromExistingHistoryRodentlocation(m *models.HistoryRodentlocation) *HistoryRodentlocationTemplate { o := &HistoryRodentlocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -2727,6 +2773,7 @@ func (f *Factory) FromExistingHistoryRodentlocation(m *models.HistoryRodentlocat o.Usetype = func() null.Val[string] { return m.Usetype } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2763,7 +2810,7 @@ func (f *Factory) NewHistorySamplecollectionWithContext(ctx context.Context, mod func (f *Factory) FromExistingHistorySamplecollection(m *models.HistorySamplecollection) *HistorySamplecollectionTemplate { o := &HistorySamplecollectionTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Activity = func() null.Val[string] { return m.Activity } o.Avetemp = func() null.Val[float64] { return m.Avetemp } o.Chickenid = func() null.Val[string] { return m.Chickenid } @@ -2806,6 +2853,7 @@ func (f *Factory) FromExistingHistorySamplecollection(m *models.HistorySamplecol o.Windspeed = func() null.Val[float64] { return m.Windspeed } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2841,7 +2889,7 @@ func (f *Factory) NewHistorySamplelocationWithContext(ctx context.Context, mods func (f *Factory) FromExistingHistorySamplelocation(m *models.HistorySamplelocation) *HistorySamplelocationTemplate { o := &HistorySamplelocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -2862,6 +2910,7 @@ func (f *Factory) FromExistingHistorySamplelocation(m *models.HistorySamplelocat o.Usetype = func() null.Val[string] { return m.Usetype } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -2897,7 +2946,7 @@ func (f *Factory) NewHistoryServicerequestWithContext(ctx context.Context, mods func (f *Factory) FromExistingHistoryServicerequest(m *models.HistoryServicerequest) *HistoryServicerequestTemplate { o := &HistoryServicerequestTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accepted = func() null.Val[int16] { return m.Accepted } o.Acceptedby = func() null.Val[string] { return m.Acceptedby } o.Accepteddate = func() null.Val[int64] { return m.Accepteddate } @@ -2976,6 +3025,7 @@ func (f *Factory) FromExistingHistoryServicerequest(m *models.HistoryServicerequ o.Yvalue = func() null.Val[string] { return m.Yvalue } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3015,7 +3065,7 @@ func (f *Factory) NewHistorySpeciesabundanceWithContext(ctx context.Context, mod func (f *Factory) FromExistingHistorySpeciesabundance(m *models.HistorySpeciesabundance) *HistorySpeciesabundanceTemplate { o := &HistorySpeciesabundanceTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Bloodedfem = func() null.Val[int16] { return m.Bloodedfem } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -3035,6 +3085,7 @@ func (f *Factory) FromExistingHistorySpeciesabundance(m *models.HistorySpeciesab o.Total = func() null.Val[int64] { return m.Total } o.TrapdataID = func() null.Val[string] { return m.TrapdataID } o.Unknown = func() null.Val[int16] { return m.Unknown } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3076,7 +3127,7 @@ func (f *Factory) NewHistoryStormdrainWithContext(ctx context.Context, mods ...H func (f *Factory) FromExistingHistoryStormdrain(m *models.HistoryStormdrain) *HistoryStormdrainTemplate { o := &HistoryStormdrainTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -3092,6 +3143,7 @@ func (f *Factory) FromExistingHistoryStormdrain(m *models.HistoryStormdrain) *Hi o.Type = func() null.Val[string] { return m.Type } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3127,7 +3179,7 @@ func (f *Factory) NewHistoryTimecardWithContext(ctx context.Context, mods ...His func (f *Factory) FromExistingHistoryTimecard(m *models.HistoryTimecard) *HistoryTimecardTemplate { o := &HistoryTimecardTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Activity = func() null.Val[string] { return m.Activity } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } @@ -3151,6 +3203,7 @@ func (f *Factory) FromExistingHistoryTimecard(m *models.HistoryTimecard) *Histor o.Traplocid = func() null.Val[string] { return m.Traplocid } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3187,7 +3240,7 @@ func (f *Factory) NewHistoryTrapdatumWithContext(ctx context.Context, mods ...Hi func (f *Factory) FromExistingHistoryTrapdatum(m *models.HistoryTrapdatum) *HistoryTrapdatumTemplate { o := &HistoryTrapdatumTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Avetemp = func() null.Val[float64] { return m.Avetemp } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } @@ -3223,6 +3276,7 @@ func (f *Factory) FromExistingHistoryTrapdatum(m *models.HistoryTrapdatum) *Hist o.Windspeed = func() null.Val[float64] { return m.Windspeed } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3261,7 +3315,7 @@ func (f *Factory) NewHistoryTraplocationWithContext(ctx context.Context, mods .. func (f *Factory) FromExistingHistoryTraplocation(m *models.HistoryTraplocation) *HistoryTraplocationTemplate { o := &HistoryTraplocationTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Accessdesc = func() null.Val[string] { return m.Accessdesc } o.Active = func() null.Val[int16] { return m.Active } o.Comments = func() null.Val[string] { return m.Comments } @@ -3282,6 +3336,7 @@ func (f *Factory) FromExistingHistoryTraplocation(m *models.HistoryTraplocation) o.Usetype = func() null.Val[string] { return m.Usetype } o.Zone = func() null.Val[string] { return m.Zone } o.Zone2 = func() null.Val[string] { return m.Zone2 } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3323,7 +3378,7 @@ func (f *Factory) NewHistoryTreatmentWithContext(ctx context.Context, mods ...Hi func (f *Factory) FromExistingHistoryTreatment(m *models.HistoryTreatment) *HistoryTreatmentTemplate { o := &HistoryTreatmentTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Activity = func() null.Val[string] { return m.Activity } o.Areaunit = func() null.Val[string] { return m.Areaunit } o.Avetemp = func() null.Val[float64] { return m.Avetemp } @@ -3409,7 +3464,7 @@ func (f *Factory) NewHistoryTreatmentareaWithContext(ctx context.Context, mods . func (f *Factory) FromExistingHistoryTreatmentarea(m *models.HistoryTreatmentarea) *HistoryTreatmentareaTemplate { o := &HistoryTreatmentareaTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Comments = func() null.Val[string] { return m.Comments } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -3424,6 +3479,7 @@ func (f *Factory) FromExistingHistoryTreatmentarea(m *models.HistoryTreatmentare o.Treatdate = func() null.Val[int64] { return m.Treatdate } o.TreatID = func() null.Val[string] { return m.TreatID } o.Type = func() null.Val[string] { return m.Type } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3459,7 +3515,7 @@ func (f *Factory) NewHistoryZoneWithContext(ctx context.Context, mods ...History func (f *Factory) FromExistingHistoryZone(m *models.HistoryZone) *HistoryZoneTemplate { o := &HistoryZoneTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Active = func() null.Val[int64] { return m.Active } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } @@ -3470,6 +3526,7 @@ func (f *Factory) FromExistingHistoryZone(m *models.HistoryZone) *HistoryZoneTem o.Objectid = func() int32 { return m.Objectid } o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3505,7 +3562,7 @@ func (f *Factory) NewHistoryZones2WithContext(ctx context.Context, mods ...Histo func (f *Factory) FromExistingHistoryZones2(m *models.HistoryZones2) *HistoryZones2Template { o := &HistoryZones2Template{f: f, alreadyPersisted: true} - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.OrganizationID = func() int32 { return m.OrganizationID } o.Creationdate = func() null.Val[int64] { return m.Creationdate } o.Creator = func() null.Val[string] { return m.Creator } o.Editdate = func() null.Val[int64] { return m.Editdate } @@ -3515,6 +3572,7 @@ func (f *Factory) FromExistingHistoryZones2(m *models.HistoryZones2) *HistoryZon o.Objectid = func() int32 { return m.Objectid } o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } + o.Created = func() null.Val[time.Time] { return m.Created } o.CreatedDate = func() null.Val[int64] { return m.CreatedDate } o.CreatedUser = func() null.Val[string] { return m.CreatedUser } o.GeometryX = func() null.Val[float64] { return m.GeometryX } @@ -3594,6 +3652,9 @@ func (f *Factory) FromExistingOrganization(m *models.Organization) *Organization o.FieldseekerURL = func() null.Val[string] { return m.FieldseekerURL } ctx := context.Background() + if len(m.R.FieldseekerSyncs) > 0 { + OrganizationMods.AddExistingFieldseekerSyncs(m.R.FieldseekerSyncs...).Apply(ctx, o) + } if len(m.R.FSContainerrelates) > 0 { OrganizationMods.AddExistingFSContainerrelates(m.R.FSContainerrelates...).Apply(ctx, o) } @@ -3832,6 +3893,14 @@ func (f *Factory) FromExistingUser(m *models.User) *UserTemplate { return o } +func (f *Factory) ClearBaseFieldseekerSyncMods() { + f.baseFieldseekerSyncMods = nil +} + +func (f *Factory) AddBaseFieldseekerSyncMod(mods ...FieldseekerSyncMod) { + f.baseFieldseekerSyncMods = append(f.baseFieldseekerSyncMods, mods...) +} + func (f *Factory) ClearBaseFSContainerrelateMods() { f.baseFSContainerrelateMods = nil } diff --git a/factory/bobfactory_main.bob_test.go b/factory/bobfactory_main.bob_test.go index 93ebb148..bd614c5d 100644 --- a/factory/bobfactory_main.bob_test.go +++ b/factory/bobfactory_main.bob_test.go @@ -8,6 +8,30 @@ import ( "testing" ) +func TestCreateFieldseekerSync(t *testing.T) { + if testDB == nil { + t.Skip("skipping test, no DSN provided") + } + + ctx, cancel := context.WithCancel(t.Context()) + t.Cleanup(cancel) + + tx, err := testDB.Begin(ctx) + if err != nil { + t.Fatalf("Error starting transaction: %v", err) + } + + defer func() { + if err := tx.Rollback(ctx); err != nil { + t.Fatalf("Error rolling back transaction: %v", err) + } + }() + + if _, err := New().NewFieldseekerSyncWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating FieldseekerSync: %v", err) + } +} + func TestCreateFSContainerrelate(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") diff --git a/factory/fieldseeker_sync.bob.go b/factory/fieldseeker_sync.bob.go new file mode 100644 index 00000000..a874e5aa --- /dev/null +++ b/factory/fieldseeker_sync.bob.go @@ -0,0 +1,538 @@ +// Code generated by BobGen psql v0.41.1. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package factory + +import ( + "context" + "testing" + "time" + + models "github.com/Gleipnir-Technology/nidus-sync/models" + "github.com/aarondl/opt/omit" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type FieldseekerSyncMod interface { + Apply(context.Context, *FieldseekerSyncTemplate) +} + +type FieldseekerSyncModFunc func(context.Context, *FieldseekerSyncTemplate) + +func (f FieldseekerSyncModFunc) Apply(ctx context.Context, n *FieldseekerSyncTemplate) { + f(ctx, n) +} + +type FieldseekerSyncModSlice []FieldseekerSyncMod + +func (mods FieldseekerSyncModSlice) Apply(ctx context.Context, n *FieldseekerSyncTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// FieldseekerSyncTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type FieldseekerSyncTemplate struct { + ID func() int32 + Created func() time.Time + RecordsCreated func() int32 + RecordsUpdated func() int32 + RecordsUnchanged func() int32 + OrganizationID func() int32 + + r fieldseekerSyncR + f *Factory + + alreadyPersisted bool +} + +type fieldseekerSyncR struct { + Organization *fieldseekerSyncROrganizationR +} + +type fieldseekerSyncROrganizationR struct { + o *OrganizationTemplate +} + +// Apply mods to the FieldseekerSyncTemplate +func (o *FieldseekerSyncTemplate) Apply(ctx context.Context, mods ...FieldseekerSyncMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.FieldseekerSync +// according to the relationships in the template. Nothing is inserted into the db +func (t FieldseekerSyncTemplate) setModelRels(o *models.FieldseekerSync) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.FieldseekerSyncs = append(rel.R.FieldseekerSyncs, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} + +// BuildSetter returns an *models.FieldseekerSyncSetter +// this does nothing with the relationship templates +func (o FieldseekerSyncTemplate) BuildSetter() *models.FieldseekerSyncSetter { + m := &models.FieldseekerSyncSetter{} + + if o.ID != nil { + val := o.ID() + m.ID = omit.From(val) + } + if o.Created != nil { + val := o.Created() + m.Created = omit.From(val) + } + if o.RecordsCreated != nil { + val := o.RecordsCreated() + m.RecordsCreated = omit.From(val) + } + if o.RecordsUpdated != nil { + val := o.RecordsUpdated() + m.RecordsUpdated = omit.From(val) + } + if o.RecordsUnchanged != nil { + val := o.RecordsUnchanged() + m.RecordsUnchanged = omit.From(val) + } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.FieldseekerSyncSetter +// this does nothing with the relationship templates +func (o FieldseekerSyncTemplate) BuildManySetter(number int) []*models.FieldseekerSyncSetter { + m := make([]*models.FieldseekerSyncSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.FieldseekerSync +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FieldseekerSyncTemplate.Create +func (o FieldseekerSyncTemplate) Build() *models.FieldseekerSync { + m := &models.FieldseekerSync{} + + if o.ID != nil { + m.ID = o.ID() + } + if o.Created != nil { + m.Created = o.Created() + } + if o.RecordsCreated != nil { + m.RecordsCreated = o.RecordsCreated() + } + if o.RecordsUpdated != nil { + m.RecordsUpdated = o.RecordsUpdated() + } + if o.RecordsUnchanged != nil { + m.RecordsUnchanged = o.RecordsUnchanged() + } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.FieldseekerSyncSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use FieldseekerSyncTemplate.CreateMany +func (o FieldseekerSyncTemplate) BuildMany(number int) models.FieldseekerSyncSlice { + m := make(models.FieldseekerSyncSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableFieldseekerSync(m *models.FieldseekerSyncSetter) { + if !(m.RecordsCreated.IsValue()) { + val := random_int32(nil) + m.RecordsCreated = omit.From(val) + } + if !(m.RecordsUpdated.IsValue()) { + val := random_int32(nil) + m.RecordsUpdated = omit.From(val) + } + if !(m.RecordsUnchanged.IsValue()) { + val := random_int32(nil) + m.RecordsUnchanged = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.FieldseekerSync +// according to the relationships in the template. +// any required relationship should have already exist on the model +func (o *FieldseekerSyncTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerSync) error { + var err error + + return err +} + +// Create builds a fieldseekerSync and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *FieldseekerSyncTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerSync, error) { + var err error + opt := o.BuildSetter() + ensureCreatableFieldseekerSync(opt) + + if o.r.Organization == nil { + FieldseekerSyncMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + + m, err := models.FieldseekerSyncs.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + m.R.Organization = rel0 + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a fieldseekerSync and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *FieldseekerSyncTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerSync { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a fieldseekerSync and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs +func (o *FieldseekerSyncTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerSync { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple fieldseekerSyncs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o FieldseekerSyncTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerSyncSlice, error) { + var err error + m := make(models.FieldseekerSyncSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple fieldseekerSyncs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o FieldseekerSyncTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerSyncSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple fieldseekerSyncs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs +func (o FieldseekerSyncTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerSyncSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// FieldseekerSync has methods that act as mods for the FieldseekerSyncTemplate +var FieldseekerSyncMods fieldseekerSyncMods + +type fieldseekerSyncMods struct{} + +func (m fieldseekerSyncMods) RandomizeAllColumns(f *faker.Faker) FieldseekerSyncMod { + return FieldseekerSyncModSlice{ + FieldseekerSyncMods.RandomID(f), + FieldseekerSyncMods.RandomCreated(f), + FieldseekerSyncMods.RandomRecordsCreated(f), + FieldseekerSyncMods.RandomRecordsUpdated(f), + FieldseekerSyncMods.RandomRecordsUnchanged(f), + FieldseekerSyncMods.RandomOrganizationID(f), + } +} + +// Set the model columns to this value +func (m fieldseekerSyncMods) ID(val int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.ID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSyncMods) IDFunc(f func() int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.ID = f + }) +} + +// Clear any values for the column +func (m fieldseekerSyncMods) UnsetID() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.ID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSyncMods) RandomID(f *faker.Faker) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.ID = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSyncMods) Created(val time.Time) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.Created = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSyncMods) CreatedFunc(f func() time.Time) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m fieldseekerSyncMods) UnsetCreated() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSyncMods) RandomCreated(f *faker.Faker) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.Created = func() time.Time { + return random_time_Time(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSyncMods) RecordsCreated(val int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsCreated = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSyncMods) RecordsCreatedFunc(f func() int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsCreated = f + }) +} + +// Clear any values for the column +func (m fieldseekerSyncMods) UnsetRecordsCreated() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsCreated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSyncMods) RandomRecordsCreated(f *faker.Faker) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsCreated = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSyncMods) RecordsUpdated(val int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUpdated = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSyncMods) RecordsUpdatedFunc(f func() int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUpdated = f + }) +} + +// Clear any values for the column +func (m fieldseekerSyncMods) UnsetRecordsUpdated() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUpdated = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSyncMods) RandomRecordsUpdated(f *faker.Faker) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUpdated = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSyncMods) RecordsUnchanged(val int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUnchanged = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSyncMods) RecordsUnchangedFunc(f func() int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUnchanged = f + }) +} + +// Clear any values for the column +func (m fieldseekerSyncMods) UnsetRecordsUnchanged() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUnchanged = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSyncMods) RandomRecordsUnchanged(f *faker.Faker) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.RecordsUnchanged = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSyncMods) OrganizationID(val int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSyncMods) OrganizationIDFunc(f func() int32) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerSyncMods) UnsetOrganizationID() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.OrganizationID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSyncMods) RandomOrganizationID(f *faker.Faker) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + +func (m fieldseekerSyncMods) WithParentsCascading() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { + if isDone, _ := fieldseekerSyncWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = fieldseekerSyncWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerSyncMods) WithOrganization(rel *OrganizationTemplate) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { + o.r.Organization = &fieldseekerSyncROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerSyncMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerSyncMods) WithExistingOrganization(em *models.Organization) FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { + o.r.Organization = &fieldseekerSyncROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerSyncMods) WithoutOrganization() FieldseekerSyncMod { + return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { + o.r.Organization = nil + }) +} diff --git a/factory/fs_containerrelate.bob.go b/factory/fs_containerrelate.bob.go index c0f229ca..aaa74e16 100644 --- a/factory/fs_containerrelate.bob.go +++ b/factory/fs_containerrelate.bob.go @@ -37,7 +37,7 @@ func (mods FSContainerrelateModSlice) Apply(ctx context.Context, n *FSContainerr // FSContainerrelateTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSContainerrelateTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Containertype func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -83,7 +83,7 @@ func (t FSContainerrelateTemplate) setModelRels(o *models.FSContainerrelate) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSContainerrelates = append(rel.R.FSContainerrelates, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -95,7 +95,7 @@ func (o FSContainerrelateTemplate) BuildSetter() *models.FSContainerrelateSetter if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Containertype != nil { val := o.Containertype() @@ -261,6 +261,10 @@ func (o FSContainerrelateTemplate) BuildMany(number int) models.FSContainerrelat } func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -273,25 +277,6 @@ func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) { func (o *FSContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSContainerrelate) error { var err error - isOrganizationDone, _ := fsContainerrelateRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsContainerrelateRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -302,11 +287,30 @@ func (o *FSContainerrelateTemplate) Create(ctx context.Context, exec bob.Executo opt := o.BuildSetter() ensureCreatableFSContainerrelate(opt) + if o.r.Organization == nil { + FSContainerrelateMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSContainerrelates.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -406,14 +410,14 @@ func (m fsContainerrelateMods) RandomizeAllColumns(f *faker.Faker) FSContainerre } // Set the model columns to this value -func (m fsContainerrelateMods) OrganizationID(val null.Val[int32]) FSContainerrelateMod { +func (m fsContainerrelateMods) OrganizationID(val int32) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsContainerrelateMods) OrganizationIDFunc(f func() null.Val[int32]) FSContainerrelateMod { +func (m fsContainerrelateMods) OrganizationIDFunc(f func() int32) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { o.OrganizationID = f }) @@ -428,32 +432,10 @@ func (m fsContainerrelateMods) UnsetOrganizationID() FSContainerrelateMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsContainerrelateMods) RandomOrganizationID(f *faker.Faker) FSContainerrelateMod { return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsContainerrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_fieldscoutinglog.bob.go b/factory/fs_fieldscoutinglog.bob.go index 7e3bfd17..0720c278 100644 --- a/factory/fs_fieldscoutinglog.bob.go +++ b/factory/fs_fieldscoutinglog.bob.go @@ -37,7 +37,7 @@ func (mods FSFieldscoutinglogModSlice) Apply(ctx context.Context, n *FSFieldscou // FSFieldscoutinglogTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSFieldscoutinglogTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -80,7 +80,7 @@ func (t FSFieldscoutinglogTemplate) setModelRels(o *models.FSFieldscoutinglog) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSFieldscoutinglogs = append(rel.R.FSFieldscoutinglogs, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -92,7 +92,7 @@ func (o FSFieldscoutinglogTemplate) BuildSetter() *models.FSFieldscoutinglogSett if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -237,6 +237,10 @@ func (o FSFieldscoutinglogTemplate) BuildMany(number int) models.FSFieldscouting } func ensureCreatableFSFieldscoutinglog(m *models.FSFieldscoutinglogSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -249,25 +253,6 @@ func ensureCreatableFSFieldscoutinglog(m *models.FSFieldscoutinglogSetter) { func (o *FSFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSFieldscoutinglog) error { var err error - isOrganizationDone, _ := fsFieldscoutinglogRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsFieldscoutinglogRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -278,11 +263,30 @@ func (o *FSFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.Execut opt := o.BuildSetter() ensureCreatableFSFieldscoutinglog(opt) + if o.r.Organization == nil { + FSFieldscoutinglogMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSFieldscoutinglogs.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -379,14 +383,14 @@ func (m fsFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) FSFieldscout } // Set the model columns to this value -func (m fsFieldscoutinglogMods) OrganizationID(val null.Val[int32]) FSFieldscoutinglogMod { +func (m fsFieldscoutinglogMods) OrganizationID(val int32) FSFieldscoutinglogMod { return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsFieldscoutinglogMods) OrganizationIDFunc(f func() null.Val[int32]) FSFieldscoutinglogMod { +func (m fsFieldscoutinglogMods) OrganizationIDFunc(f func() int32) FSFieldscoutinglogMod { return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { o.OrganizationID = f }) @@ -401,32 +405,10 @@ func (m fsFieldscoutinglogMods) UnsetOrganizationID() FSFieldscoutinglogMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) FSFieldscoutinglogMod { return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsFieldscoutinglogMods) RandomOrganizationIDNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_habitatrelate.bob.go b/factory/fs_habitatrelate.bob.go index 71e8dc2b..70bd484b 100644 --- a/factory/fs_habitatrelate.bob.go +++ b/factory/fs_habitatrelate.bob.go @@ -37,7 +37,7 @@ func (mods FSHabitatrelateModSlice) Apply(ctx context.Context, n *FSHabitatrelat // FSHabitatrelateTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSHabitatrelateTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -81,7 +81,7 @@ func (t FSHabitatrelateTemplate) setModelRels(o *models.FSHabitatrelate) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSHabitatrelates = append(rel.R.FSHabitatrelates, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -93,7 +93,7 @@ func (o FSHabitatrelateTemplate) BuildSetter() *models.FSHabitatrelateSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -245,6 +245,10 @@ func (o FSHabitatrelateTemplate) BuildMany(number int) models.FSHabitatrelateSli } func ensureCreatableFSHabitatrelate(m *models.FSHabitatrelateSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -257,25 +261,6 @@ func ensureCreatableFSHabitatrelate(m *models.FSHabitatrelateSetter) { func (o *FSHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSHabitatrelate) error { var err error - isOrganizationDone, _ := fsHabitatrelateRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsHabitatrelateRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -286,11 +271,30 @@ func (o *FSHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableFSHabitatrelate(opt) + if o.r.Organization == nil { + FSHabitatrelateMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSHabitatrelates.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -388,14 +392,14 @@ func (m fsHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) FSHabitatrelate } // Set the model columns to this value -func (m fsHabitatrelateMods) OrganizationID(val null.Val[int32]) FSHabitatrelateMod { +func (m fsHabitatrelateMods) OrganizationID(val int32) FSHabitatrelateMod { return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsHabitatrelateMods) OrganizationIDFunc(f func() null.Val[int32]) FSHabitatrelateMod { +func (m fsHabitatrelateMods) OrganizationIDFunc(f func() int32) FSHabitatrelateMod { return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { o.OrganizationID = f }) @@ -410,32 +414,10 @@ func (m fsHabitatrelateMods) UnsetOrganizationID() FSHabitatrelateMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsHabitatrelateMods) RandomOrganizationID(f *faker.Faker) FSHabitatrelateMod { return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsHabitatrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_inspectionsample.bob.go b/factory/fs_inspectionsample.bob.go index 759ff44a..7e495db7 100644 --- a/factory/fs_inspectionsample.bob.go +++ b/factory/fs_inspectionsample.bob.go @@ -37,7 +37,7 @@ func (mods FSInspectionsampleModSlice) Apply(ctx context.Context, n *FSInspectio // FSInspectionsampleTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSInspectionsampleTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -83,7 +83,7 @@ func (t FSInspectionsampleTemplate) setModelRels(o *models.FSInspectionsample) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSInspectionsamples = append(rel.R.FSInspectionsamples, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -95,7 +95,7 @@ func (o FSInspectionsampleTemplate) BuildSetter() *models.FSInspectionsampleSett if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -261,6 +261,10 @@ func (o FSInspectionsampleTemplate) BuildMany(number int) models.FSInspectionsam } func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -273,25 +277,6 @@ func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) { func (o *FSInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSInspectionsample) error { var err error - isOrganizationDone, _ := fsInspectionsampleRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsInspectionsampleRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -302,11 +287,30 @@ func (o *FSInspectionsampleTemplate) Create(ctx context.Context, exec bob.Execut opt := o.BuildSetter() ensureCreatableFSInspectionsample(opt) + if o.r.Organization == nil { + FSInspectionsampleMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSInspectionsamples.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -406,14 +410,14 @@ func (m fsInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) FSInspection } // Set the model columns to this value -func (m fsInspectionsampleMods) OrganizationID(val null.Val[int32]) FSInspectionsampleMod { +func (m fsInspectionsampleMods) OrganizationID(val int32) FSInspectionsampleMod { return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsInspectionsampleMods) OrganizationIDFunc(f func() null.Val[int32]) FSInspectionsampleMod { +func (m fsInspectionsampleMods) OrganizationIDFunc(f func() int32) FSInspectionsampleMod { return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { o.OrganizationID = f }) @@ -428,32 +432,10 @@ func (m fsInspectionsampleMods) UnsetOrganizationID() FSInspectionsampleMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsInspectionsampleMods) RandomOrganizationID(f *faker.Faker) FSInspectionsampleMod { return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsInspectionsampleMods) RandomOrganizationIDNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_inspectionsampledetail.bob.go b/factory/fs_inspectionsampledetail.bob.go index 698803e9..7a34ddb3 100644 --- a/factory/fs_inspectionsampledetail.bob.go +++ b/factory/fs_inspectionsampledetail.bob.go @@ -37,7 +37,7 @@ func (mods FSInspectionsampledetailModSlice) Apply(ctx context.Context, n *FSIns // FSInspectionsampledetailTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSInspectionsampledetailTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Comments func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -94,7 +94,7 @@ func (t FSInspectionsampledetailTemplate) setModelRels(o *models.FSInspectionsam if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSInspectionsampledetails = append(rel.R.FSInspectionsampledetails, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -106,7 +106,7 @@ func (o FSInspectionsampledetailTemplate) BuildSetter() *models.FSInspectionsamp if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Comments != nil { val := o.Comments() @@ -349,6 +349,10 @@ func (o FSInspectionsampledetailTemplate) BuildMany(number int) models.FSInspect } func ensureCreatableFSInspectionsampledetail(m *models.FSInspectionsampledetailSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -361,25 +365,6 @@ func ensureCreatableFSInspectionsampledetail(m *models.FSInspectionsampledetailS func (o *FSInspectionsampledetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSInspectionsampledetail) error { var err error - isOrganizationDone, _ := fsInspectionsampledetailRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsInspectionsampledetailRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -390,11 +375,30 @@ func (o *FSInspectionsampledetailTemplate) Create(ctx context.Context, exec bob. opt := o.BuildSetter() ensureCreatableFSInspectionsampledetail(opt) + if o.r.Organization == nil { + FSInspectionsampledetailMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSInspectionsampledetails.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -505,14 +509,14 @@ func (m fsInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) FSInsp } // Set the model columns to this value -func (m fsInspectionsampledetailMods) OrganizationID(val null.Val[int32]) FSInspectionsampledetailMod { +func (m fsInspectionsampledetailMods) OrganizationID(val int32) FSInspectionsampledetailMod { return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsInspectionsampledetailMods) OrganizationIDFunc(f func() null.Val[int32]) FSInspectionsampledetailMod { +func (m fsInspectionsampledetailMods) OrganizationIDFunc(f func() int32) FSInspectionsampledetailMod { return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { o.OrganizationID = f }) @@ -527,32 +531,10 @@ func (m fsInspectionsampledetailMods) UnsetOrganizationID() FSInspectionsamplede // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsInspectionsampledetailMods) RandomOrganizationID(f *faker.Faker) FSInspectionsampledetailMod { return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsInspectionsampledetailMods) RandomOrganizationIDNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_linelocation.bob.go b/factory/fs_linelocation.bob.go index 4ead1ee8..2238698b 100644 --- a/factory/fs_linelocation.bob.go +++ b/factory/fs_linelocation.bob.go @@ -37,7 +37,7 @@ func (mods FSLinelocationModSlice) Apply(ctx context.Context, n *FSLinelocationT // FSLinelocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSLinelocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Acres func() null.Val[float64] Active func() null.Val[int16] @@ -117,7 +117,7 @@ func (t FSLinelocationTemplate) setModelRels(o *models.FSLinelocation) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSLinelocations = append(rel.R.FSLinelocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -129,7 +129,7 @@ func (o FSLinelocationTemplate) BuildSetter() *models.FSLinelocationSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -533,6 +533,10 @@ func (o FSLinelocationTemplate) BuildMany(number int) models.FSLinelocationSlice } func ensureCreatableFSLinelocation(m *models.FSLinelocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -545,25 +549,6 @@ func ensureCreatableFSLinelocation(m *models.FSLinelocationSetter) { func (o *FSLinelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSLinelocation) error { var err error - isOrganizationDone, _ := fsLinelocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsLinelocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -574,11 +559,30 @@ func (o *FSLinelocationTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableFSLinelocation(opt) + if o.r.Organization == nil { + FSLinelocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSLinelocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -712,14 +716,14 @@ func (m fsLinelocationMods) RandomizeAllColumns(f *faker.Faker) FSLinelocationMo } // Set the model columns to this value -func (m fsLinelocationMods) OrganizationID(val null.Val[int32]) FSLinelocationMod { +func (m fsLinelocationMods) OrganizationID(val int32) FSLinelocationMod { return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsLinelocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSLinelocationMod { +func (m fsLinelocationMods) OrganizationIDFunc(f func() int32) FSLinelocationMod { return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { o.OrganizationID = f }) @@ -734,32 +738,10 @@ func (m fsLinelocationMods) UnsetOrganizationID() FSLinelocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsLinelocationMods) RandomOrganizationID(f *faker.Faker) FSLinelocationMod { return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsLinelocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_locationtracking.bob.go b/factory/fs_locationtracking.bob.go index 625cbcd6..21925d9c 100644 --- a/factory/fs_locationtracking.bob.go +++ b/factory/fs_locationtracking.bob.go @@ -37,7 +37,7 @@ func (mods FSLocationtrackingModSlice) Apply(ctx context.Context, n *FSLocationt // FSLocationtrackingTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSLocationtrackingTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accuracy func() null.Val[float64] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -81,7 +81,7 @@ func (t FSLocationtrackingTemplate) setModelRels(o *models.FSLocationtracking) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSLocationtrackings = append(rel.R.FSLocationtrackings, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -93,7 +93,7 @@ func (o FSLocationtrackingTemplate) BuildSetter() *models.FSLocationtrackingSett if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accuracy != nil { val := o.Accuracy() @@ -245,6 +245,10 @@ func (o FSLocationtrackingTemplate) BuildMany(number int) models.FSLocationtrack } func ensureCreatableFSLocationtracking(m *models.FSLocationtrackingSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -257,25 +261,6 @@ func ensureCreatableFSLocationtracking(m *models.FSLocationtrackingSetter) { func (o *FSLocationtrackingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSLocationtracking) error { var err error - isOrganizationDone, _ := fsLocationtrackingRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsLocationtrackingRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -286,11 +271,30 @@ func (o *FSLocationtrackingTemplate) Create(ctx context.Context, exec bob.Execut opt := o.BuildSetter() ensureCreatableFSLocationtracking(opt) + if o.r.Organization == nil { + FSLocationtrackingMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSLocationtrackings.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -388,14 +392,14 @@ func (m fsLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) FSLocationtr } // Set the model columns to this value -func (m fsLocationtrackingMods) OrganizationID(val null.Val[int32]) FSLocationtrackingMod { +func (m fsLocationtrackingMods) OrganizationID(val int32) FSLocationtrackingMod { return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsLocationtrackingMods) OrganizationIDFunc(f func() null.Val[int32]) FSLocationtrackingMod { +func (m fsLocationtrackingMods) OrganizationIDFunc(f func() int32) FSLocationtrackingMod { return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { o.OrganizationID = f }) @@ -410,32 +414,10 @@ func (m fsLocationtrackingMods) UnsetOrganizationID() FSLocationtrackingMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsLocationtrackingMods) RandomOrganizationID(f *faker.Faker) FSLocationtrackingMod { return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsLocationtrackingMods) RandomOrganizationIDNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_mosquitoinspection.bob.go b/factory/fs_mosquitoinspection.bob.go index cbbb7daf..0e7d2a13 100644 --- a/factory/fs_mosquitoinspection.bob.go +++ b/factory/fs_mosquitoinspection.bob.go @@ -37,7 +37,7 @@ func (mods FSMosquitoinspectionModSlice) Apply(ctx context.Context, n *FSMosquit // FSMosquitoinspectionTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSMosquitoinspectionTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Actiontaken func() null.Val[string] Activity func() null.Val[string] Adultact func() null.Val[string] @@ -126,7 +126,7 @@ func (t FSMosquitoinspectionTemplate) setModelRels(o *models.FSMosquitoinspectio if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSMosquitoinspections = append(rel.R.FSMosquitoinspections, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -138,7 +138,7 @@ func (o FSMosquitoinspectionTemplate) BuildSetter() *models.FSMosquitoinspection if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Actiontaken != nil { val := o.Actiontaken() @@ -605,6 +605,10 @@ func (o FSMosquitoinspectionTemplate) BuildMany(number int) models.FSMosquitoins } func ensureCreatableFSMosquitoinspection(m *models.FSMosquitoinspectionSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -617,25 +621,6 @@ func ensureCreatableFSMosquitoinspection(m *models.FSMosquitoinspectionSetter) { func (o *FSMosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSMosquitoinspection) error { var err error - isOrganizationDone, _ := fsMosquitoinspectionRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsMosquitoinspectionRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -646,11 +631,30 @@ func (o *FSMosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Exec opt := o.BuildSetter() ensureCreatableFSMosquitoinspection(opt) + if o.r.Organization == nil { + FSMosquitoinspectionMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSMosquitoinspections.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -793,14 +797,14 @@ func (m fsMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSMosquito } // Set the model columns to this value -func (m fsMosquitoinspectionMods) OrganizationID(val null.Val[int32]) FSMosquitoinspectionMod { +func (m fsMosquitoinspectionMods) OrganizationID(val int32) FSMosquitoinspectionMod { return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsMosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSMosquitoinspectionMod { +func (m fsMosquitoinspectionMods) OrganizationIDFunc(f func() int32) FSMosquitoinspectionMod { return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { o.OrganizationID = f }) @@ -815,32 +819,10 @@ func (m fsMosquitoinspectionMods) UnsetOrganizationID() FSMosquitoinspectionMod // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsMosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FSMosquitoinspectionMod { return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsMosquitoinspectionMods) RandomOrganizationIDNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_pointlocation.bob.go b/factory/fs_pointlocation.bob.go index 97115ddc..f3fb73fc 100644 --- a/factory/fs_pointlocation.bob.go +++ b/factory/fs_pointlocation.bob.go @@ -37,7 +37,7 @@ func (mods FSPointlocationModSlice) Apply(ctx context.Context, n *FSPointlocatio // FSPointlocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSPointlocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -113,7 +113,7 @@ func (t FSPointlocationTemplate) setModelRels(o *models.FSPointlocation) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSPointlocations = append(rel.R.FSPointlocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -125,7 +125,7 @@ func (o FSPointlocationTemplate) BuildSetter() *models.FSPointlocationSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -501,6 +501,10 @@ func (o FSPointlocationTemplate) BuildMany(number int) models.FSPointlocationSli } func ensureCreatableFSPointlocation(m *models.FSPointlocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -513,25 +517,6 @@ func ensureCreatableFSPointlocation(m *models.FSPointlocationSetter) { func (o *FSPointlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPointlocation) error { var err error - isOrganizationDone, _ := fsPointlocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsPointlocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -542,11 +527,30 @@ func (o *FSPointlocationTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableFSPointlocation(opt) + if o.r.Organization == nil { + FSPointlocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSPointlocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -676,14 +680,14 @@ func (m fsPointlocationMods) RandomizeAllColumns(f *faker.Faker) FSPointlocation } // Set the model columns to this value -func (m fsPointlocationMods) OrganizationID(val null.Val[int32]) FSPointlocationMod { +func (m fsPointlocationMods) OrganizationID(val int32) FSPointlocationMod { return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsPointlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSPointlocationMod { +func (m fsPointlocationMods) OrganizationIDFunc(f func() int32) FSPointlocationMod { return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { o.OrganizationID = f }) @@ -698,32 +702,10 @@ func (m fsPointlocationMods) UnsetOrganizationID() FSPointlocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsPointlocationMods) RandomOrganizationID(f *faker.Faker) FSPointlocationMod { return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsPointlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_polygonlocation.bob.go b/factory/fs_polygonlocation.bob.go index 7b58260e..ea819efa 100644 --- a/factory/fs_polygonlocation.bob.go +++ b/factory/fs_polygonlocation.bob.go @@ -37,7 +37,7 @@ func (mods FSPolygonlocationModSlice) Apply(ctx context.Context, n *FSPolygonloc // FSPolygonlocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSPolygonlocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Acres func() null.Val[float64] Active func() null.Val[int16] @@ -111,7 +111,7 @@ func (t FSPolygonlocationTemplate) setModelRels(o *models.FSPolygonlocation) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSPolygonlocations = append(rel.R.FSPolygonlocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -123,7 +123,7 @@ func (o FSPolygonlocationTemplate) BuildSetter() *models.FSPolygonlocationSetter if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -485,6 +485,10 @@ func (o FSPolygonlocationTemplate) BuildMany(number int) models.FSPolygonlocatio } func ensureCreatableFSPolygonlocation(m *models.FSPolygonlocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -497,25 +501,6 @@ func ensureCreatableFSPolygonlocation(m *models.FSPolygonlocationSetter) { func (o *FSPolygonlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPolygonlocation) error { var err error - isOrganizationDone, _ := fsPolygonlocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsPolygonlocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -526,11 +511,30 @@ func (o *FSPolygonlocationTemplate) Create(ctx context.Context, exec bob.Executo opt := o.BuildSetter() ensureCreatableFSPolygonlocation(opt) + if o.r.Organization == nil { + FSPolygonlocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSPolygonlocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -658,14 +662,14 @@ func (m fsPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) FSPolygonloca } // Set the model columns to this value -func (m fsPolygonlocationMods) OrganizationID(val null.Val[int32]) FSPolygonlocationMod { +func (m fsPolygonlocationMods) OrganizationID(val int32) FSPolygonlocationMod { return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsPolygonlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSPolygonlocationMod { +func (m fsPolygonlocationMods) OrganizationIDFunc(f func() int32) FSPolygonlocationMod { return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { o.OrganizationID = f }) @@ -680,32 +684,10 @@ func (m fsPolygonlocationMods) UnsetOrganizationID() FSPolygonlocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsPolygonlocationMods) RandomOrganizationID(f *faker.Faker) FSPolygonlocationMod { return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsPolygonlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_pool.bob.go b/factory/fs_pool.bob.go index fb12a727..ce005bfc 100644 --- a/factory/fs_pool.bob.go +++ b/factory/fs_pool.bob.go @@ -37,7 +37,7 @@ func (mods FSPoolModSlice) Apply(ctx context.Context, n *FSPoolTemplate) { // FSPoolTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSPoolTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Comments func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -97,7 +97,7 @@ func (t FSPoolTemplate) setModelRels(o *models.FSPool) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSPools = append(rel.R.FSPools, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -109,7 +109,7 @@ func (o FSPoolTemplate) BuildSetter() *models.FSPoolSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Comments != nil { val := o.Comments() @@ -373,6 +373,10 @@ func (o FSPoolTemplate) BuildMany(number int) models.FSPoolSlice { } func ensureCreatableFSPool(m *models.FSPoolSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -385,25 +389,6 @@ func ensureCreatableFSPool(m *models.FSPoolSetter) { func (o *FSPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPool) error { var err error - isOrganizationDone, _ := fsPoolRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsPoolRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -414,11 +399,30 @@ func (o *FSPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models opt := o.BuildSetter() ensureCreatableFSPool(opt) + if o.r.Organization == nil { + FSPoolMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSPools.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -532,14 +536,14 @@ func (m fsPoolMods) RandomizeAllColumns(f *faker.Faker) FSPoolMod { } // Set the model columns to this value -func (m fsPoolMods) OrganizationID(val null.Val[int32]) FSPoolMod { +func (m fsPoolMods) OrganizationID(val int32) FSPoolMod { return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsPoolMods) OrganizationIDFunc(f func() null.Val[int32]) FSPoolMod { +func (m fsPoolMods) OrganizationIDFunc(f func() int32) FSPoolMod { return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { o.OrganizationID = f }) @@ -554,32 +558,10 @@ func (m fsPoolMods) UnsetOrganizationID() FSPoolMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsPoolMods) RandomOrganizationID(f *faker.Faker) FSPoolMod { return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsPoolMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_pooldetail.bob.go b/factory/fs_pooldetail.bob.go index d9ce3c6f..b923d55d 100644 --- a/factory/fs_pooldetail.bob.go +++ b/factory/fs_pooldetail.bob.go @@ -37,7 +37,7 @@ func (mods FSPooldetailModSlice) Apply(ctx context.Context, n *FSPooldetailTempl // FSPooldetailTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSPooldetailTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -83,7 +83,7 @@ func (t FSPooldetailTemplate) setModelRels(o *models.FSPooldetail) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSPooldetails = append(rel.R.FSPooldetails, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -95,7 +95,7 @@ func (o FSPooldetailTemplate) BuildSetter() *models.FSPooldetailSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -261,6 +261,10 @@ func (o FSPooldetailTemplate) BuildMany(number int) models.FSPooldetailSlice { } func ensureCreatableFSPooldetail(m *models.FSPooldetailSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -273,25 +277,6 @@ func ensureCreatableFSPooldetail(m *models.FSPooldetailSetter) { func (o *FSPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPooldetail) error { var err error - isOrganizationDone, _ := fsPooldetailRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsPooldetailRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -302,11 +287,30 @@ func (o *FSPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (* opt := o.BuildSetter() ensureCreatableFSPooldetail(opt) + if o.r.Organization == nil { + FSPooldetailMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSPooldetails.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -406,14 +410,14 @@ func (m fsPooldetailMods) RandomizeAllColumns(f *faker.Faker) FSPooldetailMod { } // Set the model columns to this value -func (m fsPooldetailMods) OrganizationID(val null.Val[int32]) FSPooldetailMod { +func (m fsPooldetailMods) OrganizationID(val int32) FSPooldetailMod { return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsPooldetailMods) OrganizationIDFunc(f func() null.Val[int32]) FSPooldetailMod { +func (m fsPooldetailMods) OrganizationIDFunc(f func() int32) FSPooldetailMod { return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { o.OrganizationID = f }) @@ -428,32 +432,10 @@ func (m fsPooldetailMods) UnsetOrganizationID() FSPooldetailMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsPooldetailMods) RandomOrganizationID(f *faker.Faker) FSPooldetailMod { return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsPooldetailMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_proposedtreatmentarea.bob.go b/factory/fs_proposedtreatmentarea.bob.go index fda9e1ec..53367925 100644 --- a/factory/fs_proposedtreatmentarea.bob.go +++ b/factory/fs_proposedtreatmentarea.bob.go @@ -37,7 +37,7 @@ func (mods FSProposedtreatmentareaModSlice) Apply(ctx context.Context, n *FSProp // FSProposedtreatmentareaTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSProposedtreatmentareaTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Acres func() null.Val[float64] Comments func() null.Val[string] Completed func() null.Val[int16] @@ -102,7 +102,7 @@ func (t FSProposedtreatmentareaTemplate) setModelRels(o *models.FSProposedtreatm if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSProposedtreatmentareas = append(rel.R.FSProposedtreatmentareas, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -114,7 +114,7 @@ func (o FSProposedtreatmentareaTemplate) BuildSetter() *models.FSProposedtreatme if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Acres != nil { val := o.Acres() @@ -413,6 +413,10 @@ func (o FSProposedtreatmentareaTemplate) BuildMany(number int) models.FSProposed } func ensureCreatableFSProposedtreatmentarea(m *models.FSProposedtreatmentareaSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -425,25 +429,6 @@ func ensureCreatableFSProposedtreatmentarea(m *models.FSProposedtreatmentareaSet func (o *FSProposedtreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSProposedtreatmentarea) error { var err error - isOrganizationDone, _ := fsProposedtreatmentareaRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsProposedtreatmentareaRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -454,11 +439,30 @@ func (o *FSProposedtreatmentareaTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableFSProposedtreatmentarea(opt) + if o.r.Organization == nil { + FSProposedtreatmentareaMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSProposedtreatmentareas.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -577,14 +581,14 @@ func (m fsProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSPropo } // Set the model columns to this value -func (m fsProposedtreatmentareaMods) OrganizationID(val null.Val[int32]) FSProposedtreatmentareaMod { +func (m fsProposedtreatmentareaMods) OrganizationID(val int32) FSProposedtreatmentareaMod { return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsProposedtreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) FSProposedtreatmentareaMod { +func (m fsProposedtreatmentareaMods) OrganizationIDFunc(f func() int32) FSProposedtreatmentareaMod { return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { o.OrganizationID = f }) @@ -599,32 +603,10 @@ func (m fsProposedtreatmentareaMods) UnsetOrganizationID() FSProposedtreatmentar // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsProposedtreatmentareaMods) RandomOrganizationID(f *faker.Faker) FSProposedtreatmentareaMod { return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsProposedtreatmentareaMods) RandomOrganizationIDNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_qamosquitoinspection.bob.go b/factory/fs_qamosquitoinspection.bob.go index cdb8d67d..dba27de0 100644 --- a/factory/fs_qamosquitoinspection.bob.go +++ b/factory/fs_qamosquitoinspection.bob.go @@ -37,7 +37,7 @@ func (mods FSQamosquitoinspectionModSlice) Apply(ctx context.Context, n *FSQamos // FSQamosquitoinspectionTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSQamosquitoinspectionTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Acresbreeding func() null.Val[float64] Actiontaken func() null.Val[string] Adultactivity func() null.Val[int16] @@ -131,7 +131,7 @@ func (t FSQamosquitoinspectionTemplate) setModelRels(o *models.FSQamosquitoinspe if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSQamosquitoinspections = append(rel.R.FSQamosquitoinspections, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -143,7 +143,7 @@ func (o FSQamosquitoinspectionTemplate) BuildSetter() *models.FSQamosquitoinspec if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Acresbreeding != nil { val := o.Acresbreeding() @@ -645,6 +645,10 @@ func (o FSQamosquitoinspectionTemplate) BuildMany(number int) models.FSQamosquit } func ensureCreatableFSQamosquitoinspection(m *models.FSQamosquitoinspectionSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -657,25 +661,6 @@ func ensureCreatableFSQamosquitoinspection(m *models.FSQamosquitoinspectionSette func (o *FSQamosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSQamosquitoinspection) error { var err error - isOrganizationDone, _ := fsQamosquitoinspectionRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsQamosquitoinspectionRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -686,11 +671,30 @@ func (o *FSQamosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Ex opt := o.BuildSetter() ensureCreatableFSQamosquitoinspection(opt) + if o.r.Organization == nil { + FSQamosquitoinspectionMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSQamosquitoinspections.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -838,14 +842,14 @@ func (m fsQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSQamosq } // Set the model columns to this value -func (m fsQamosquitoinspectionMods) OrganizationID(val null.Val[int32]) FSQamosquitoinspectionMod { +func (m fsQamosquitoinspectionMods) OrganizationID(val int32) FSQamosquitoinspectionMod { return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsQamosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSQamosquitoinspectionMod { +func (m fsQamosquitoinspectionMods) OrganizationIDFunc(f func() int32) FSQamosquitoinspectionMod { return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { o.OrganizationID = f }) @@ -860,32 +864,10 @@ func (m fsQamosquitoinspectionMods) UnsetOrganizationID() FSQamosquitoinspection // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsQamosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FSQamosquitoinspectionMod { return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsQamosquitoinspectionMods) RandomOrganizationIDNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_rodentlocation.bob.go b/factory/fs_rodentlocation.bob.go index 6abe7057..7804b0fd 100644 --- a/factory/fs_rodentlocation.bob.go +++ b/factory/fs_rodentlocation.bob.go @@ -37,7 +37,7 @@ func (mods FSRodentlocationModSlice) Apply(ctx context.Context, n *FSRodentlocat // FSRodentlocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSRodentlocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -99,7 +99,7 @@ func (t FSRodentlocationTemplate) setModelRels(o *models.FSRodentlocation) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSRodentlocations = append(rel.R.FSRodentlocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -111,7 +111,7 @@ func (o FSRodentlocationTemplate) BuildSetter() *models.FSRodentlocationSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -389,6 +389,10 @@ func (o FSRodentlocationTemplate) BuildMany(number int) models.FSRodentlocationS } func ensureCreatableFSRodentlocation(m *models.FSRodentlocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -401,25 +405,6 @@ func ensureCreatableFSRodentlocation(m *models.FSRodentlocationSetter) { func (o *FSRodentlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSRodentlocation) error { var err error - isOrganizationDone, _ := fsRodentlocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsRodentlocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -430,11 +415,30 @@ func (o *FSRodentlocationTemplate) Create(ctx context.Context, exec bob.Executor opt := o.BuildSetter() ensureCreatableFSRodentlocation(opt) + if o.r.Organization == nil { + FSRodentlocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSRodentlocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -550,14 +554,14 @@ func (m fsRodentlocationMods) RandomizeAllColumns(f *faker.Faker) FSRodentlocati } // Set the model columns to this value -func (m fsRodentlocationMods) OrganizationID(val null.Val[int32]) FSRodentlocationMod { +func (m fsRodentlocationMods) OrganizationID(val int32) FSRodentlocationMod { return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsRodentlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSRodentlocationMod { +func (m fsRodentlocationMods) OrganizationIDFunc(f func() int32) FSRodentlocationMod { return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { o.OrganizationID = f }) @@ -572,32 +576,10 @@ func (m fsRodentlocationMods) UnsetOrganizationID() FSRodentlocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsRodentlocationMods) RandomOrganizationID(f *faker.Faker) FSRodentlocationMod { return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsRodentlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_samplecollection.bob.go b/factory/fs_samplecollection.bob.go index 2b17a87e..b69883b0 100644 --- a/factory/fs_samplecollection.bob.go +++ b/factory/fs_samplecollection.bob.go @@ -37,7 +37,7 @@ func (mods FSSamplecollectionModSlice) Apply(ctx context.Context, n *FSSamplecol // FSSamplecollectionTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSSamplecollectionTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Activity func() null.Val[string] Avetemp func() null.Val[float64] Chickenid func() null.Val[string] @@ -115,7 +115,7 @@ func (t FSSamplecollectionTemplate) setModelRels(o *models.FSSamplecollection) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSSamplecollections = append(rel.R.FSSamplecollections, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -127,7 +127,7 @@ func (o FSSamplecollectionTemplate) BuildSetter() *models.FSSamplecollectionSett if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Activity != nil { val := o.Activity() @@ -517,6 +517,10 @@ func (o FSSamplecollectionTemplate) BuildMany(number int) models.FSSamplecollect } func ensureCreatableFSSamplecollection(m *models.FSSamplecollectionSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -529,25 +533,6 @@ func ensureCreatableFSSamplecollection(m *models.FSSamplecollectionSetter) { func (o *FSSamplecollectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSamplecollection) error { var err error - isOrganizationDone, _ := fsSamplecollectionRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsSamplecollectionRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -558,11 +543,30 @@ func (o *FSSamplecollectionTemplate) Create(ctx context.Context, exec bob.Execut opt := o.BuildSetter() ensureCreatableFSSamplecollection(opt) + if o.r.Organization == nil { + FSSamplecollectionMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSSamplecollections.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -694,14 +698,14 @@ func (m fsSamplecollectionMods) RandomizeAllColumns(f *faker.Faker) FSSamplecoll } // Set the model columns to this value -func (m fsSamplecollectionMods) OrganizationID(val null.Val[int32]) FSSamplecollectionMod { +func (m fsSamplecollectionMods) OrganizationID(val int32) FSSamplecollectionMod { return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsSamplecollectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSSamplecollectionMod { +func (m fsSamplecollectionMods) OrganizationIDFunc(f func() int32) FSSamplecollectionMod { return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { o.OrganizationID = f }) @@ -716,32 +720,10 @@ func (m fsSamplecollectionMods) UnsetOrganizationID() FSSamplecollectionMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsSamplecollectionMods) RandomOrganizationID(f *faker.Faker) FSSamplecollectionMod { return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsSamplecollectionMods) RandomOrganizationIDNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_samplelocation.bob.go b/factory/fs_samplelocation.bob.go index 050ed6aa..2303810f 100644 --- a/factory/fs_samplelocation.bob.go +++ b/factory/fs_samplelocation.bob.go @@ -37,7 +37,7 @@ func (mods FSSamplelocationModSlice) Apply(ctx context.Context, n *FSSamplelocat // FSSamplelocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSSamplelocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -93,7 +93,7 @@ func (t FSSamplelocationTemplate) setModelRels(o *models.FSSamplelocation) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSSamplelocations = append(rel.R.FSSamplelocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -105,7 +105,7 @@ func (o FSSamplelocationTemplate) BuildSetter() *models.FSSamplelocationSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -341,6 +341,10 @@ func (o FSSamplelocationTemplate) BuildMany(number int) models.FSSamplelocationS } func ensureCreatableFSSamplelocation(m *models.FSSamplelocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -353,25 +357,6 @@ func ensureCreatableFSSamplelocation(m *models.FSSamplelocationSetter) { func (o *FSSamplelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSamplelocation) error { var err error - isOrganizationDone, _ := fsSamplelocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsSamplelocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -382,11 +367,30 @@ func (o *FSSamplelocationTemplate) Create(ctx context.Context, exec bob.Executor opt := o.BuildSetter() ensureCreatableFSSamplelocation(opt) + if o.r.Organization == nil { + FSSamplelocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSSamplelocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -496,14 +500,14 @@ func (m fsSamplelocationMods) RandomizeAllColumns(f *faker.Faker) FSSamplelocati } // Set the model columns to this value -func (m fsSamplelocationMods) OrganizationID(val null.Val[int32]) FSSamplelocationMod { +func (m fsSamplelocationMods) OrganizationID(val int32) FSSamplelocationMod { return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsSamplelocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSSamplelocationMod { +func (m fsSamplelocationMods) OrganizationIDFunc(f func() int32) FSSamplelocationMod { return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { o.OrganizationID = f }) @@ -518,32 +522,10 @@ func (m fsSamplelocationMods) UnsetOrganizationID() FSSamplelocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsSamplelocationMods) RandomOrganizationID(f *faker.Faker) FSSamplelocationMod { return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsSamplelocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_servicerequest.bob.go b/factory/fs_servicerequest.bob.go index 9ce7f294..10f9ecd3 100644 --- a/factory/fs_servicerequest.bob.go +++ b/factory/fs_servicerequest.bob.go @@ -37,7 +37,7 @@ func (mods FSServicerequestModSlice) Apply(ctx context.Context, n *FSServicerequ // FSServicerequestTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSServicerequestTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accepted func() null.Val[int16] Acceptedby func() null.Val[string] Accepteddate func() null.Val[int64] @@ -155,7 +155,7 @@ func (t FSServicerequestTemplate) setModelRels(o *models.FSServicerequest) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSServicerequests = append(rel.R.FSServicerequests, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -167,7 +167,7 @@ func (o FSServicerequestTemplate) BuildSetter() *models.FSServicerequestSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accepted != nil { val := o.Accepted() @@ -837,6 +837,10 @@ func (o FSServicerequestTemplate) BuildMany(number int) models.FSServicerequestS } func ensureCreatableFSServicerequest(m *models.FSServicerequestSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -849,25 +853,6 @@ func ensureCreatableFSServicerequest(m *models.FSServicerequestSetter) { func (o *FSServicerequestTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSServicerequest) error { var err error - isOrganizationDone, _ := fsServicerequestRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsServicerequestRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -878,11 +863,30 @@ func (o *FSServicerequestTemplate) Create(ctx context.Context, exec bob.Executor opt := o.BuildSetter() ensureCreatableFSServicerequest(opt) + if o.r.Organization == nil { + FSServicerequestMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSServicerequests.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -1054,14 +1058,14 @@ func (m fsServicerequestMods) RandomizeAllColumns(f *faker.Faker) FSServicereque } // Set the model columns to this value -func (m fsServicerequestMods) OrganizationID(val null.Val[int32]) FSServicerequestMod { +func (m fsServicerequestMods) OrganizationID(val int32) FSServicerequestMod { return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsServicerequestMods) OrganizationIDFunc(f func() null.Val[int32]) FSServicerequestMod { +func (m fsServicerequestMods) OrganizationIDFunc(f func() int32) FSServicerequestMod { return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { o.OrganizationID = f }) @@ -1076,32 +1080,10 @@ func (m fsServicerequestMods) UnsetOrganizationID() FSServicerequestMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsServicerequestMods) RandomOrganizationID(f *faker.Faker) FSServicerequestMod { return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsServicerequestMods) RandomOrganizationIDNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_speciesabundance.bob.go b/factory/fs_speciesabundance.bob.go index 860197b2..e26c08aa 100644 --- a/factory/fs_speciesabundance.bob.go +++ b/factory/fs_speciesabundance.bob.go @@ -37,7 +37,7 @@ func (mods FSSpeciesabundanceModSlice) Apply(ctx context.Context, n *FSSpeciesab // FSSpeciesabundanceTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSSpeciesabundanceTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Bloodedfem func() null.Val[int16] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -98,7 +98,7 @@ func (t FSSpeciesabundanceTemplate) setModelRels(o *models.FSSpeciesabundance) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSSpeciesabundances = append(rel.R.FSSpeciesabundances, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -110,7 +110,7 @@ func (o FSSpeciesabundanceTemplate) BuildSetter() *models.FSSpeciesabundanceSett if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Bloodedfem != nil { val := o.Bloodedfem() @@ -381,6 +381,10 @@ func (o FSSpeciesabundanceTemplate) BuildMany(number int) models.FSSpeciesabunda } func ensureCreatableFSSpeciesabundance(m *models.FSSpeciesabundanceSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -393,25 +397,6 @@ func ensureCreatableFSSpeciesabundance(m *models.FSSpeciesabundanceSetter) { func (o *FSSpeciesabundanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSpeciesabundance) error { var err error - isOrganizationDone, _ := fsSpeciesabundanceRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsSpeciesabundanceRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -422,11 +407,30 @@ func (o *FSSpeciesabundanceTemplate) Create(ctx context.Context, exec bob.Execut opt := o.BuildSetter() ensureCreatableFSSpeciesabundance(opt) + if o.r.Organization == nil { + FSSpeciesabundanceMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSSpeciesabundances.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -541,14 +545,14 @@ func (m fsSpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) FSSpeciesabu } // Set the model columns to this value -func (m fsSpeciesabundanceMods) OrganizationID(val null.Val[int32]) FSSpeciesabundanceMod { +func (m fsSpeciesabundanceMods) OrganizationID(val int32) FSSpeciesabundanceMod { return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsSpeciesabundanceMods) OrganizationIDFunc(f func() null.Val[int32]) FSSpeciesabundanceMod { +func (m fsSpeciesabundanceMods) OrganizationIDFunc(f func() int32) FSSpeciesabundanceMod { return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { o.OrganizationID = f }) @@ -563,32 +567,10 @@ func (m fsSpeciesabundanceMods) UnsetOrganizationID() FSSpeciesabundanceMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsSpeciesabundanceMods) RandomOrganizationID(f *faker.Faker) FSSpeciesabundanceMod { return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsSpeciesabundanceMods) RandomOrganizationIDNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_stormdrain.bob.go b/factory/fs_stormdrain.bob.go index 983f8456..95fbce2a 100644 --- a/factory/fs_stormdrain.bob.go +++ b/factory/fs_stormdrain.bob.go @@ -37,7 +37,7 @@ func (mods FSStormdrainModSlice) Apply(ctx context.Context, n *FSStormdrainTempl // FSStormdrainTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSStormdrainTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -88,7 +88,7 @@ func (t FSStormdrainTemplate) setModelRels(o *models.FSStormdrain) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSStormdrains = append(rel.R.FSStormdrains, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -100,7 +100,7 @@ func (o FSStormdrainTemplate) BuildSetter() *models.FSStormdrainSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -301,6 +301,10 @@ func (o FSStormdrainTemplate) BuildMany(number int) models.FSStormdrainSlice { } func ensureCreatableFSStormdrain(m *models.FSStormdrainSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -313,25 +317,6 @@ func ensureCreatableFSStormdrain(m *models.FSStormdrainSetter) { func (o *FSStormdrainTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSStormdrain) error { var err error - isOrganizationDone, _ := fsStormdrainRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsStormdrainRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -342,11 +327,30 @@ func (o *FSStormdrainTemplate) Create(ctx context.Context, exec bob.Executor) (* opt := o.BuildSetter() ensureCreatableFSStormdrain(opt) + if o.r.Organization == nil { + FSStormdrainMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSStormdrains.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -451,14 +455,14 @@ func (m fsStormdrainMods) RandomizeAllColumns(f *faker.Faker) FSStormdrainMod { } // Set the model columns to this value -func (m fsStormdrainMods) OrganizationID(val null.Val[int32]) FSStormdrainMod { +func (m fsStormdrainMods) OrganizationID(val int32) FSStormdrainMod { return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsStormdrainMods) OrganizationIDFunc(f func() null.Val[int32]) FSStormdrainMod { +func (m fsStormdrainMods) OrganizationIDFunc(f func() int32) FSStormdrainMod { return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { o.OrganizationID = f }) @@ -473,32 +477,10 @@ func (m fsStormdrainMods) UnsetOrganizationID() FSStormdrainMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsStormdrainMods) RandomOrganizationID(f *faker.Faker) FSStormdrainMod { return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsStormdrainMods) RandomOrganizationIDNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_timecard.bob.go b/factory/fs_timecard.bob.go index b701a84f..0291b2e6 100644 --- a/factory/fs_timecard.bob.go +++ b/factory/fs_timecard.bob.go @@ -37,7 +37,7 @@ func (mods FSTimecardModSlice) Apply(ctx context.Context, n *FSTimecardTemplate) // FSTimecardTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSTimecardTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Activity func() null.Val[string] Comments func() null.Val[string] Creationdate func() null.Val[int64] @@ -97,7 +97,7 @@ func (t FSTimecardTemplate) setModelRels(o *models.FSTimecard) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSTimecards = append(rel.R.FSTimecards, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -109,7 +109,7 @@ func (o FSTimecardTemplate) BuildSetter() *models.FSTimecardSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Activity != nil { val := o.Activity() @@ -373,6 +373,10 @@ func (o FSTimecardTemplate) BuildMany(number int) models.FSTimecardSlice { } func ensureCreatableFSTimecard(m *models.FSTimecardSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -385,25 +389,6 @@ func ensureCreatableFSTimecard(m *models.FSTimecardSetter) { func (o *FSTimecardTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTimecard) error { var err error - isOrganizationDone, _ := fsTimecardRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsTimecardRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -414,11 +399,30 @@ func (o *FSTimecardTemplate) Create(ctx context.Context, exec bob.Executor) (*mo opt := o.BuildSetter() ensureCreatableFSTimecard(opt) + if o.r.Organization == nil { + FSTimecardMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSTimecards.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -532,14 +536,14 @@ func (m fsTimecardMods) RandomizeAllColumns(f *faker.Faker) FSTimecardMod { } // Set the model columns to this value -func (m fsTimecardMods) OrganizationID(val null.Val[int32]) FSTimecardMod { +func (m fsTimecardMods) OrganizationID(val int32) FSTimecardMod { return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsTimecardMods) OrganizationIDFunc(f func() null.Val[int32]) FSTimecardMod { +func (m fsTimecardMods) OrganizationIDFunc(f func() int32) FSTimecardMod { return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { o.OrganizationID = f }) @@ -554,32 +558,10 @@ func (m fsTimecardMods) UnsetOrganizationID() FSTimecardMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsTimecardMods) RandomOrganizationID(f *faker.Faker) FSTimecardMod { return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsTimecardMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_trapdata.bob.go b/factory/fs_trapdata.bob.go index df4c827c..a6b6a1af 100644 --- a/factory/fs_trapdata.bob.go +++ b/factory/fs_trapdata.bob.go @@ -37,7 +37,7 @@ func (mods FSTrapdatumModSlice) Apply(ctx context.Context, n *FSTrapdatumTemplat // FSTrapdatumTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSTrapdatumTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Avetemp func() null.Val[float64] Comments func() null.Val[string] Creationdate func() null.Val[int64] @@ -111,7 +111,7 @@ func (t FSTrapdatumTemplate) setModelRels(o *models.FSTrapdatum) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSTrapdata = append(rel.R.FSTrapdata, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -123,7 +123,7 @@ func (o FSTrapdatumTemplate) BuildSetter() *models.FSTrapdatumSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Avetemp != nil { val := o.Avetemp() @@ -485,6 +485,10 @@ func (o FSTrapdatumTemplate) BuildMany(number int) models.FSTrapdatumSlice { } func ensureCreatableFSTrapdatum(m *models.FSTrapdatumSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -497,25 +501,6 @@ func ensureCreatableFSTrapdatum(m *models.FSTrapdatumSetter) { func (o *FSTrapdatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTrapdatum) error { var err error - isOrganizationDone, _ := fsTrapdatumRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsTrapdatumRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -526,11 +511,30 @@ func (o *FSTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor) (*m opt := o.BuildSetter() ensureCreatableFSTrapdatum(opt) + if o.r.Organization == nil { + FSTrapdatumMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSTrapdata.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -658,14 +662,14 @@ func (m fsTrapdatumMods) RandomizeAllColumns(f *faker.Faker) FSTrapdatumMod { } // Set the model columns to this value -func (m fsTrapdatumMods) OrganizationID(val null.Val[int32]) FSTrapdatumMod { +func (m fsTrapdatumMods) OrganizationID(val int32) FSTrapdatumMod { return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsTrapdatumMods) OrganizationIDFunc(f func() null.Val[int32]) FSTrapdatumMod { +func (m fsTrapdatumMods) OrganizationIDFunc(f func() int32) FSTrapdatumMod { return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { o.OrganizationID = f }) @@ -680,32 +684,10 @@ func (m fsTrapdatumMods) UnsetOrganizationID() FSTrapdatumMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsTrapdatumMods) RandomOrganizationID(f *faker.Faker) FSTrapdatumMod { return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsTrapdatumMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_traplocation.bob.go b/factory/fs_traplocation.bob.go index 909c2a66..e7641229 100644 --- a/factory/fs_traplocation.bob.go +++ b/factory/fs_traplocation.bob.go @@ -37,7 +37,7 @@ func (mods FSTraplocationModSlice) Apply(ctx context.Context, n *FSTraplocationT // FSTraplocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSTraplocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -99,7 +99,7 @@ func (t FSTraplocationTemplate) setModelRels(o *models.FSTraplocation) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSTraplocations = append(rel.R.FSTraplocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -111,7 +111,7 @@ func (o FSTraplocationTemplate) BuildSetter() *models.FSTraplocationSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -389,6 +389,10 @@ func (o FSTraplocationTemplate) BuildMany(number int) models.FSTraplocationSlice } func ensureCreatableFSTraplocation(m *models.FSTraplocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -401,25 +405,6 @@ func ensureCreatableFSTraplocation(m *models.FSTraplocationSetter) { func (o *FSTraplocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTraplocation) error { var err error - isOrganizationDone, _ := fsTraplocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsTraplocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -430,11 +415,30 @@ func (o *FSTraplocationTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableFSTraplocation(opt) + if o.r.Organization == nil { + FSTraplocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSTraplocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -550,14 +554,14 @@ func (m fsTraplocationMods) RandomizeAllColumns(f *faker.Faker) FSTraplocationMo } // Set the model columns to this value -func (m fsTraplocationMods) OrganizationID(val null.Val[int32]) FSTraplocationMod { +func (m fsTraplocationMods) OrganizationID(val int32) FSTraplocationMod { return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsTraplocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSTraplocationMod { +func (m fsTraplocationMods) OrganizationIDFunc(f func() int32) FSTraplocationMod { return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { o.OrganizationID = f }) @@ -572,32 +576,10 @@ func (m fsTraplocationMods) UnsetOrganizationID() FSTraplocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsTraplocationMods) RandomOrganizationID(f *faker.Faker) FSTraplocationMod { return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsTraplocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_treatment.bob.go b/factory/fs_treatment.bob.go index f3550cee..df23dfd5 100644 --- a/factory/fs_treatment.bob.go +++ b/factory/fs_treatment.bob.go @@ -37,7 +37,7 @@ func (mods FSTreatmentModSlice) Apply(ctx context.Context, n *FSTreatmentTemplat // FSTreatmentTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSTreatmentTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Activity func() null.Val[string] Areaunit func() null.Val[string] Avetemp func() null.Val[float64] @@ -123,7 +123,7 @@ func (t FSTreatmentTemplate) setModelRels(o *models.FSTreatment) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSTreatments = append(rel.R.FSTreatments, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -135,7 +135,7 @@ func (o FSTreatmentTemplate) BuildSetter() *models.FSTreatmentSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Activity != nil { val := o.Activity() @@ -581,6 +581,10 @@ func (o FSTreatmentTemplate) BuildMany(number int) models.FSTreatmentSlice { } func ensureCreatableFSTreatment(m *models.FSTreatmentSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -593,25 +597,6 @@ func ensureCreatableFSTreatment(m *models.FSTreatmentSetter) { func (o *FSTreatmentTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTreatment) error { var err error - isOrganizationDone, _ := fsTreatmentRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsTreatmentRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -622,11 +607,30 @@ func (o *FSTreatmentTemplate) Create(ctx context.Context, exec bob.Executor) (*m opt := o.BuildSetter() ensureCreatableFSTreatment(opt) + if o.r.Organization == nil { + FSTreatmentMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSTreatments.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -766,14 +770,14 @@ func (m fsTreatmentMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentMod { } // Set the model columns to this value -func (m fsTreatmentMods) OrganizationID(val null.Val[int32]) FSTreatmentMod { +func (m fsTreatmentMods) OrganizationID(val int32) FSTreatmentMod { return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsTreatmentMods) OrganizationIDFunc(f func() null.Val[int32]) FSTreatmentMod { +func (m fsTreatmentMods) OrganizationIDFunc(f func() int32) FSTreatmentMod { return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { o.OrganizationID = f }) @@ -788,32 +792,10 @@ func (m fsTreatmentMods) UnsetOrganizationID() FSTreatmentMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsTreatmentMods) RandomOrganizationID(f *faker.Faker) FSTreatmentMod { return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsTreatmentMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_treatmentarea.bob.go b/factory/fs_treatmentarea.bob.go index 8fac25a9..fa157ce6 100644 --- a/factory/fs_treatmentarea.bob.go +++ b/factory/fs_treatmentarea.bob.go @@ -37,7 +37,7 @@ func (mods FSTreatmentareaModSlice) Apply(ctx context.Context, n *FSTreatmentare // FSTreatmentareaTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSTreatmentareaTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Comments func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -87,7 +87,7 @@ func (t FSTreatmentareaTemplate) setModelRels(o *models.FSTreatmentarea) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSTreatmentareas = append(rel.R.FSTreatmentareas, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -99,7 +99,7 @@ func (o FSTreatmentareaTemplate) BuildSetter() *models.FSTreatmentareaSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Comments != nil { val := o.Comments() @@ -293,6 +293,10 @@ func (o FSTreatmentareaTemplate) BuildMany(number int) models.FSTreatmentareaSli } func ensureCreatableFSTreatmentarea(m *models.FSTreatmentareaSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -305,25 +309,6 @@ func ensureCreatableFSTreatmentarea(m *models.FSTreatmentareaSetter) { func (o *FSTreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTreatmentarea) error { var err error - isOrganizationDone, _ := fsTreatmentareaRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsTreatmentareaRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -334,11 +319,30 @@ func (o *FSTreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableFSTreatmentarea(opt) + if o.r.Organization == nil { + FSTreatmentareaMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSTreatmentareas.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -442,14 +446,14 @@ func (m fsTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentarea } // Set the model columns to this value -func (m fsTreatmentareaMods) OrganizationID(val null.Val[int32]) FSTreatmentareaMod { +func (m fsTreatmentareaMods) OrganizationID(val int32) FSTreatmentareaMod { return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsTreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) FSTreatmentareaMod { +func (m fsTreatmentareaMods) OrganizationIDFunc(f func() int32) FSTreatmentareaMod { return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { o.OrganizationID = f }) @@ -464,32 +468,10 @@ func (m fsTreatmentareaMods) UnsetOrganizationID() FSTreatmentareaMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsTreatmentareaMods) RandomOrganizationID(f *faker.Faker) FSTreatmentareaMod { return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsTreatmentareaMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_zones.bob.go b/factory/fs_zones.bob.go index 5d8fabd1..61312134 100644 --- a/factory/fs_zones.bob.go +++ b/factory/fs_zones.bob.go @@ -37,7 +37,7 @@ func (mods FSZoneModSlice) Apply(ctx context.Context, n *FSZoneTemplate) { // FSZoneTemplate is an object representing the database table. // all columns are optional and should be set by mods type FSZoneTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Active func() null.Val[int64] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -83,7 +83,7 @@ func (t FSZoneTemplate) setModelRels(o *models.FSZone) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSZones = append(rel.R.FSZones, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -95,7 +95,7 @@ func (o FSZoneTemplate) BuildSetter() *models.FSZoneSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Active != nil { val := o.Active() @@ -261,6 +261,10 @@ func (o FSZoneTemplate) BuildMany(number int) models.FSZoneSlice { } func ensureCreatableFSZone(m *models.FSZoneSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -273,25 +277,6 @@ func ensureCreatableFSZone(m *models.FSZoneSetter) { func (o *FSZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSZone) error { var err error - isOrganizationDone, _ := fsZoneRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsZoneRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -302,11 +287,30 @@ func (o *FSZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models opt := o.BuildSetter() ensureCreatableFSZone(opt) + if o.r.Organization == nil { + FSZoneMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSZones.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -406,14 +410,14 @@ func (m fsZoneMods) RandomizeAllColumns(f *faker.Faker) FSZoneMod { } // Set the model columns to this value -func (m fsZoneMods) OrganizationID(val null.Val[int32]) FSZoneMod { +func (m fsZoneMods) OrganizationID(val int32) FSZoneMod { return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsZoneMods) OrganizationIDFunc(f func() null.Val[int32]) FSZoneMod { +func (m fsZoneMods) OrganizationIDFunc(f func() int32) FSZoneMod { return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { o.OrganizationID = f }) @@ -428,32 +432,10 @@ func (m fsZoneMods) UnsetOrganizationID() FSZoneMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsZoneMods) RandomOrganizationID(f *faker.Faker) FSZoneMod { return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsZoneMods) RandomOrganizationIDNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/fs_zones2.bob.go b/factory/fs_zones2.bob.go index 7d62f0ab..ec06b747 100644 --- a/factory/fs_zones2.bob.go +++ b/factory/fs_zones2.bob.go @@ -37,7 +37,7 @@ func (mods FSZones2ModSlice) Apply(ctx context.Context, n *FSZones2Template) { // FSZones2Template is an object representing the database table. // all columns are optional and should be set by mods type FSZones2Template struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -82,7 +82,7 @@ func (t FSZones2Template) setModelRels(o *models.FSZones2) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.FSZones2s = append(rel.R.FSZones2s, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -94,7 +94,7 @@ func (o FSZones2Template) BuildSetter() *models.FSZones2Setter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -253,6 +253,10 @@ func (o FSZones2Template) BuildMany(number int) models.FSZones2Slice { } func ensureCreatableFSZones2(m *models.FSZones2Setter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -265,25 +269,6 @@ func ensureCreatableFSZones2(m *models.FSZones2Setter) { func (o *FSZones2Template) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSZones2) error { var err error - isOrganizationDone, _ := fsZones2RelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = fsZones2RelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -294,11 +279,30 @@ func (o *FSZones2Template) Create(ctx context.Context, exec bob.Executor) (*mode opt := o.BuildSetter() ensureCreatableFSZones2(opt) + if o.r.Organization == nil { + FSZones2Mods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FSZones2s.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -397,14 +401,14 @@ func (m fsZones2Mods) RandomizeAllColumns(f *faker.Faker) FSZones2Mod { } // Set the model columns to this value -func (m fsZones2Mods) OrganizationID(val null.Val[int32]) FSZones2Mod { +func (m fsZones2Mods) OrganizationID(val int32) FSZones2Mod { return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m fsZones2Mods) OrganizationIDFunc(f func() null.Val[int32]) FSZones2Mod { +func (m fsZones2Mods) OrganizationIDFunc(f func() int32) FSZones2Mod { return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { o.OrganizationID = f }) @@ -419,32 +423,10 @@ func (m fsZones2Mods) UnsetOrganizationID() FSZones2Mod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m fsZones2Mods) RandomOrganizationID(f *faker.Faker) FSZones2Mod { return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fsZones2Mods) RandomOrganizationIDNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/history_containerrelate.bob.go b/factory/history_containerrelate.bob.go index 4ef01b3f..41b6cd44 100644 --- a/factory/history_containerrelate.bob.go +++ b/factory/history_containerrelate.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryContainerrelateModSlice) Apply(ctx context.Context, n *History // HistoryContainerrelateTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryContainerrelateTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Containertype func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -47,6 +48,7 @@ type HistoryContainerrelateTemplate struct { Mosquitoinspid func() null.Val[string] Objectid func() int32 Treatmentid func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -82,7 +84,7 @@ func (t HistoryContainerrelateTemplate) setModelRels(o *models.HistoryContainerr if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryContainerrelates = append(rel.R.HistoryContainerrelates, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -94,7 +96,7 @@ func (o HistoryContainerrelateTemplate) BuildSetter() *models.HistoryContainerre if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Containertype != nil { val := o.Containertype() @@ -136,6 +138,10 @@ func (o HistoryContainerrelateTemplate) BuildSetter() *models.HistoryContainerre val := o.Treatmentid() m.Treatmentid = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -219,6 +225,9 @@ func (o HistoryContainerrelateTemplate) Build() *models.HistoryContainerrelate { if o.Treatmentid != nil { m.Treatmentid = o.Treatmentid() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -260,6 +269,10 @@ func (o HistoryContainerrelateTemplate) BuildMany(number int) models.HistoryCont } func ensureCreatableHistoryContainerrelate(m *models.HistoryContainerrelateSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -276,25 +289,6 @@ func ensureCreatableHistoryContainerrelate(m *models.HistoryContainerrelateSette func (o *HistoryContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryContainerrelate) error { var err error - isOrganizationDone, _ := historyContainerrelateRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyContainerrelateRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -305,11 +299,30 @@ func (o *HistoryContainerrelateTemplate) Create(ctx context.Context, exec bob.Ex opt := o.BuildSetter() ensureCreatableHistoryContainerrelate(opt) + if o.r.Organization == nil { + HistoryContainerrelateMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryContainerrelates.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -398,6 +411,7 @@ func (m historyContainerrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryC HistoryContainerrelateMods.RandomMosquitoinspid(f), HistoryContainerrelateMods.RandomObjectid(f), HistoryContainerrelateMods.RandomTreatmentid(f), + HistoryContainerrelateMods.RandomCreated(f), HistoryContainerrelateMods.RandomCreatedDate(f), HistoryContainerrelateMods.RandomCreatedUser(f), HistoryContainerrelateMods.RandomGeometryX(f), @@ -409,14 +423,14 @@ func (m historyContainerrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryC } // Set the model columns to this value -func (m historyContainerrelateMods) OrganizationID(val null.Val[int32]) HistoryContainerrelateMod { +func (m historyContainerrelateMods) OrganizationID(val int32) HistoryContainerrelateMod { return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyContainerrelateMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryContainerrelateMod { +func (m historyContainerrelateMods) OrganizationIDFunc(f func() int32) HistoryContainerrelateMod { return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { o.OrganizationID = f }) @@ -431,32 +445,10 @@ func (m historyContainerrelateMods) UnsetOrganizationID() HistoryContainerrelate // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyContainerrelateMods) RandomOrganizationID(f *faker.Faker) HistoryContainerrelateMod { return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyContainerrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -969,6 +961,59 @@ func (m historyContainerrelateMods) RandomTreatmentidNotNull(f *faker.Faker) His }) } +// Set the model columns to this value +func (m historyContainerrelateMods) Created(val null.Val[time.Time]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyContainerrelateMods) CreatedFunc(f func() null.Val[time.Time]) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyContainerrelateMods) UnsetCreated() HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyContainerrelateMods) RandomCreated(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyContainerrelateMods) RandomCreatedNotNull(f *faker.Faker) HistoryContainerrelateMod { + return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyContainerrelateMods) CreatedDate(val null.Val[int64]) HistoryContainerrelateMod { return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { diff --git a/factory/history_fieldscoutinglog.bob.go b/factory/history_fieldscoutinglog.bob.go index 4b4ec523..887fe39a 100644 --- a/factory/history_fieldscoutinglog.bob.go +++ b/factory/history_fieldscoutinglog.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryFieldscoutinglogModSlice) Apply(ctx context.Context, n *Histor // HistoryFieldscoutinglogTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryFieldscoutinglogTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -44,6 +45,7 @@ type HistoryFieldscoutinglogTemplate struct { Globalid func() null.Val[string] Objectid func() int32 Status func() null.Val[int16] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -79,7 +81,7 @@ func (t HistoryFieldscoutinglogTemplate) setModelRels(o *models.HistoryFieldscou if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryFieldscoutinglogs = append(rel.R.HistoryFieldscoutinglogs, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -91,7 +93,7 @@ func (o HistoryFieldscoutinglogTemplate) BuildSetter() *models.HistoryFieldscout if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -121,6 +123,10 @@ func (o HistoryFieldscoutinglogTemplate) BuildSetter() *models.HistoryFieldscout val := o.Status() m.Status = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -195,6 +201,9 @@ func (o HistoryFieldscoutinglogTemplate) Build() *models.HistoryFieldscoutinglog if o.Status != nil { m.Status = o.Status() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -236,6 +245,10 @@ func (o HistoryFieldscoutinglogTemplate) BuildMany(number int) models.HistoryFie } func ensureCreatableHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglogSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -252,25 +265,6 @@ func ensureCreatableHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglogSet func (o *HistoryFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryFieldscoutinglog) error { var err error - isOrganizationDone, _ := historyFieldscoutinglogRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyFieldscoutinglogRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -281,11 +275,30 @@ func (o *HistoryFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableHistoryFieldscoutinglog(opt) + if o.r.Organization == nil { + HistoryFieldscoutinglogMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryFieldscoutinglogs.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -371,6 +384,7 @@ func (m historyFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) History HistoryFieldscoutinglogMods.RandomGlobalid(f), HistoryFieldscoutinglogMods.RandomObjectid(f), HistoryFieldscoutinglogMods.RandomStatus(f), + HistoryFieldscoutinglogMods.RandomCreated(f), HistoryFieldscoutinglogMods.RandomCreatedDate(f), HistoryFieldscoutinglogMods.RandomCreatedUser(f), HistoryFieldscoutinglogMods.RandomGeometryX(f), @@ -382,14 +396,14 @@ func (m historyFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) History } // Set the model columns to this value -func (m historyFieldscoutinglogMods) OrganizationID(val null.Val[int32]) HistoryFieldscoutinglogMod { +func (m historyFieldscoutinglogMods) OrganizationID(val int32) HistoryFieldscoutinglogMod { return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyFieldscoutinglogMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryFieldscoutinglogMod { +func (m historyFieldscoutinglogMods) OrganizationIDFunc(f func() int32) HistoryFieldscoutinglogMod { return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { o.OrganizationID = f }) @@ -404,32 +418,10 @@ func (m historyFieldscoutinglogMods) UnsetOrganizationID() HistoryFieldscoutingl // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) HistoryFieldscoutinglogMod { return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyFieldscoutinglogMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -783,6 +775,59 @@ func (m historyFieldscoutinglogMods) RandomStatusNotNull(f *faker.Faker) History }) } +// Set the model columns to this value +func (m historyFieldscoutinglogMods) Created(val null.Val[time.Time]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyFieldscoutinglogMods) CreatedFunc(f func() null.Val[time.Time]) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyFieldscoutinglogMods) UnsetCreated() HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyFieldscoutinglogMods) RandomCreated(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyFieldscoutinglogMods) RandomCreatedNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { + return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyFieldscoutinglogMods) CreatedDate(val null.Val[int64]) HistoryFieldscoutinglogMod { return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { diff --git a/factory/history_habitatrelate.bob.go b/factory/history_habitatrelate.bob.go index 8ffeaaef..f8c055e6 100644 --- a/factory/history_habitatrelate.bob.go +++ b/factory/history_habitatrelate.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryHabitatrelateModSlice) Apply(ctx context.Context, n *HistoryHa // HistoryHabitatrelateTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryHabitatrelateTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -45,6 +46,7 @@ type HistoryHabitatrelateTemplate struct { Globalid func() null.Val[string] Habitattype func() null.Val[string] Objectid func() int32 + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -80,7 +82,7 @@ func (t HistoryHabitatrelateTemplate) setModelRels(o *models.HistoryHabitatrelat if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryHabitatrelates = append(rel.R.HistoryHabitatrelates, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -92,7 +94,7 @@ func (o HistoryHabitatrelateTemplate) BuildSetter() *models.HistoryHabitatrelate if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -126,6 +128,10 @@ func (o HistoryHabitatrelateTemplate) BuildSetter() *models.HistoryHabitatrelate val := o.Objectid() m.Objectid = omit.From(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -203,6 +209,9 @@ func (o HistoryHabitatrelateTemplate) Build() *models.HistoryHabitatrelate { if o.Objectid != nil { m.Objectid = o.Objectid() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -244,6 +253,10 @@ func (o HistoryHabitatrelateTemplate) BuildMany(number int) models.HistoryHabita } func ensureCreatableHistoryHabitatrelate(m *models.HistoryHabitatrelateSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -260,25 +273,6 @@ func ensureCreatableHistoryHabitatrelate(m *models.HistoryHabitatrelateSetter) { func (o *HistoryHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryHabitatrelate) error { var err error - isOrganizationDone, _ := historyHabitatrelateRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyHabitatrelateRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -289,11 +283,30 @@ func (o *HistoryHabitatrelateTemplate) Create(ctx context.Context, exec bob.Exec opt := o.BuildSetter() ensureCreatableHistoryHabitatrelate(opt) + if o.r.Organization == nil { + HistoryHabitatrelateMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryHabitatrelates.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -380,6 +393,7 @@ func (m historyHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryHab HistoryHabitatrelateMods.RandomGlobalid(f), HistoryHabitatrelateMods.RandomHabitattype(f), HistoryHabitatrelateMods.RandomObjectid(f), + HistoryHabitatrelateMods.RandomCreated(f), HistoryHabitatrelateMods.RandomCreatedDate(f), HistoryHabitatrelateMods.RandomCreatedUser(f), HistoryHabitatrelateMods.RandomGeometryX(f), @@ -391,14 +405,14 @@ func (m historyHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryHab } // Set the model columns to this value -func (m historyHabitatrelateMods) OrganizationID(val null.Val[int32]) HistoryHabitatrelateMod { +func (m historyHabitatrelateMods) OrganizationID(val int32) HistoryHabitatrelateMod { return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyHabitatrelateMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryHabitatrelateMod { +func (m historyHabitatrelateMods) OrganizationIDFunc(f func() int32) HistoryHabitatrelateMod { return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { o.OrganizationID = f }) @@ -413,32 +427,10 @@ func (m historyHabitatrelateMods) UnsetOrganizationID() HistoryHabitatrelateMod // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyHabitatrelateMods) RandomOrganizationID(f *faker.Faker) HistoryHabitatrelateMod { return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyHabitatrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -845,6 +837,59 @@ func (m historyHabitatrelateMods) RandomObjectid(f *faker.Faker) HistoryHabitatr }) } +// Set the model columns to this value +func (m historyHabitatrelateMods) Created(val null.Val[time.Time]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyHabitatrelateMods) CreatedFunc(f func() null.Val[time.Time]) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyHabitatrelateMods) UnsetCreated() HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyHabitatrelateMods) RandomCreated(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyHabitatrelateMods) RandomCreatedNotNull(f *faker.Faker) HistoryHabitatrelateMod { + return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyHabitatrelateMods) CreatedDate(val null.Val[int64]) HistoryHabitatrelateMod { return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { diff --git a/factory/history_inspectionsample.bob.go b/factory/history_inspectionsample.bob.go index f8235121..1b30fca1 100644 --- a/factory/history_inspectionsample.bob.go +++ b/factory/history_inspectionsample.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryInspectionsampleModSlice) Apply(ctx context.Context, n *Histor // HistoryInspectionsampleTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryInspectionsampleTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -47,6 +48,7 @@ type HistoryInspectionsampleTemplate struct { Objectid func() int32 Processed func() null.Val[int16] Sampleid func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -82,7 +84,7 @@ func (t HistoryInspectionsampleTemplate) setModelRels(o *models.HistoryInspectio if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryInspectionsamples = append(rel.R.HistoryInspectionsamples, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -94,7 +96,7 @@ func (o HistoryInspectionsampleTemplate) BuildSetter() *models.HistoryInspection if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -136,6 +138,10 @@ func (o HistoryInspectionsampleTemplate) BuildSetter() *models.HistoryInspection val := o.Sampleid() m.Sampleid = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -219,6 +225,9 @@ func (o HistoryInspectionsampleTemplate) Build() *models.HistoryInspectionsample if o.Sampleid != nil { m.Sampleid = o.Sampleid() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -260,6 +269,10 @@ func (o HistoryInspectionsampleTemplate) BuildMany(number int) models.HistoryIns } func ensureCreatableHistoryInspectionsample(m *models.HistoryInspectionsampleSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -276,25 +289,6 @@ func ensureCreatableHistoryInspectionsample(m *models.HistoryInspectionsampleSet func (o *HistoryInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryInspectionsample) error { var err error - isOrganizationDone, _ := historyInspectionsampleRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyInspectionsampleRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -305,11 +299,30 @@ func (o *HistoryInspectionsampleTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableHistoryInspectionsample(opt) + if o.r.Organization == nil { + HistoryInspectionsampleMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryInspectionsamples.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -398,6 +411,7 @@ func (m historyInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) History HistoryInspectionsampleMods.RandomObjectid(f), HistoryInspectionsampleMods.RandomProcessed(f), HistoryInspectionsampleMods.RandomSampleid(f), + HistoryInspectionsampleMods.RandomCreated(f), HistoryInspectionsampleMods.RandomCreatedDate(f), HistoryInspectionsampleMods.RandomCreatedUser(f), HistoryInspectionsampleMods.RandomGeometryX(f), @@ -409,14 +423,14 @@ func (m historyInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) History } // Set the model columns to this value -func (m historyInspectionsampleMods) OrganizationID(val null.Val[int32]) HistoryInspectionsampleMod { +func (m historyInspectionsampleMods) OrganizationID(val int32) HistoryInspectionsampleMod { return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyInspectionsampleMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryInspectionsampleMod { +func (m historyInspectionsampleMods) OrganizationIDFunc(f func() int32) HistoryInspectionsampleMod { return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { o.OrganizationID = f }) @@ -431,32 +445,10 @@ func (m historyInspectionsampleMods) UnsetOrganizationID() HistoryInspectionsamp // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyInspectionsampleMods) RandomOrganizationID(f *faker.Faker) HistoryInspectionsampleMod { return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyInspectionsampleMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -969,6 +961,59 @@ func (m historyInspectionsampleMods) RandomSampleidNotNull(f *faker.Faker) Histo }) } +// Set the model columns to this value +func (m historyInspectionsampleMods) Created(val null.Val[time.Time]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampleMods) CreatedFunc(f func() null.Val[time.Time]) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampleMods) UnsetCreated() HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyInspectionsampleMods) RandomCreated(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyInspectionsampleMods) RandomCreatedNotNull(f *faker.Faker) HistoryInspectionsampleMod { + return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyInspectionsampleMods) CreatedDate(val null.Val[int64]) HistoryInspectionsampleMod { return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { diff --git a/factory/history_inspectionsampledetail.bob.go b/factory/history_inspectionsampledetail.bob.go index 961181ab..df020016 100644 --- a/factory/history_inspectionsampledetail.bob.go +++ b/factory/history_inspectionsampledetail.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryInspectionsampledetailModSlice) Apply(ctx context.Context, n * // HistoryInspectionsampledetailTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryInspectionsampledetailTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Comments func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -58,6 +59,7 @@ type HistoryInspectionsampledetailTemplate struct { Lpupcount func() null.Val[int16] Objectid func() int32 Processed func() null.Val[int16] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -93,7 +95,7 @@ func (t HistoryInspectionsampledetailTemplate) setModelRels(o *models.HistoryIns if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryInspectionsampledetails = append(rel.R.HistoryInspectionsampledetails, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -105,7 +107,7 @@ func (o HistoryInspectionsampledetailTemplate) BuildSetter() *models.HistoryInsp if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Comments != nil { val := o.Comments() @@ -191,6 +193,10 @@ func (o HistoryInspectionsampledetailTemplate) BuildSetter() *models.HistoryInsp val := o.Processed() m.Processed = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -307,6 +313,9 @@ func (o HistoryInspectionsampledetailTemplate) Build() *models.HistoryInspection if o.Processed != nil { m.Processed = o.Processed() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -348,6 +357,10 @@ func (o HistoryInspectionsampledetailTemplate) BuildMany(number int) models.Hist } func ensureCreatableHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetailSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -364,25 +377,6 @@ func ensureCreatableHistoryInspectionsampledetail(m *models.HistoryInspectionsam func (o *HistoryInspectionsampledetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryInspectionsampledetail) error { var err error - isOrganizationDone, _ := historyInspectionsampledetailRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyInspectionsampledetailRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -393,11 +387,30 @@ func (o *HistoryInspectionsampledetailTemplate) Create(ctx context.Context, exec opt := o.BuildSetter() ensureCreatableHistoryInspectionsampledetail(opt) + if o.r.Organization == nil { + HistoryInspectionsampledetailMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryInspectionsampledetails.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -497,6 +510,7 @@ func (m historyInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) H HistoryInspectionsampledetailMods.RandomLpupcount(f), HistoryInspectionsampledetailMods.RandomObjectid(f), HistoryInspectionsampledetailMods.RandomProcessed(f), + HistoryInspectionsampledetailMods.RandomCreated(f), HistoryInspectionsampledetailMods.RandomCreatedDate(f), HistoryInspectionsampledetailMods.RandomCreatedUser(f), HistoryInspectionsampledetailMods.RandomGeometryX(f), @@ -508,14 +522,14 @@ func (m historyInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) H } // Set the model columns to this value -func (m historyInspectionsampledetailMods) OrganizationID(val null.Val[int32]) HistoryInspectionsampledetailMod { +func (m historyInspectionsampledetailMods) OrganizationID(val int32) HistoryInspectionsampledetailMod { return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyInspectionsampledetailMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryInspectionsampledetailMod { +func (m historyInspectionsampledetailMods) OrganizationIDFunc(f func() int32) HistoryInspectionsampledetailMod { return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { o.OrganizationID = f }) @@ -530,32 +544,10 @@ func (m historyInspectionsampledetailMods) UnsetOrganizationID() HistoryInspecti // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyInspectionsampledetailMods) RandomOrganizationID(f *faker.Faker) HistoryInspectionsampledetailMod { return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyInspectionsampledetailMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1651,6 +1643,59 @@ func (m historyInspectionsampledetailMods) RandomProcessedNotNull(f *faker.Faker }) } +// Set the model columns to this value +func (m historyInspectionsampledetailMods) Created(val null.Val[time.Time]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyInspectionsampledetailMods) CreatedFunc(f func() null.Val[time.Time]) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyInspectionsampledetailMods) UnsetCreated() HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyInspectionsampledetailMods) RandomCreated(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyInspectionsampledetailMods) RandomCreatedNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { + return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyInspectionsampledetailMods) CreatedDate(val null.Val[int64]) HistoryInspectionsampledetailMod { return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { diff --git a/factory/history_linelocation.bob.go b/factory/history_linelocation.bob.go index f15752e8..0794a846 100644 --- a/factory/history_linelocation.bob.go +++ b/factory/history_linelocation.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryLinelocationModSlice) Apply(ctx context.Context, n *HistoryLin // HistoryLinelocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryLinelocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Acres func() null.Val[float64] Active func() null.Val[int16] @@ -81,6 +82,7 @@ type HistoryLinelocationTemplate struct { WidthMeters func() null.Val[float64] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -116,7 +118,7 @@ func (t HistoryLinelocationTemplate) setModelRels(o *models.HistoryLinelocation) if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryLinelocations = append(rel.R.HistoryLinelocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -128,7 +130,7 @@ func (o HistoryLinelocationTemplate) BuildSetter() *models.HistoryLinelocationSe if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -306,6 +308,10 @@ func (o HistoryLinelocationTemplate) BuildSetter() *models.HistoryLinelocationSe val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -491,6 +497,9 @@ func (o HistoryLinelocationTemplate) Build() *models.HistoryLinelocation { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -532,6 +541,10 @@ func (o HistoryLinelocationTemplate) BuildMany(number int) models.HistoryLineloc } func ensureCreatableHistoryLinelocation(m *models.HistoryLinelocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -548,25 +561,6 @@ func ensureCreatableHistoryLinelocation(m *models.HistoryLinelocationSetter) { func (o *HistoryLinelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryLinelocation) error { var err error - isOrganizationDone, _ := historyLinelocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyLinelocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -577,11 +571,30 @@ func (o *HistoryLinelocationTemplate) Create(ctx context.Context, exec bob.Execu opt := o.BuildSetter() ensureCreatableHistoryLinelocation(opt) + if o.r.Organization == nil { + HistoryLinelocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryLinelocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -704,6 +717,7 @@ func (m historyLinelocationMods) RandomizeAllColumns(f *faker.Faker) HistoryLine HistoryLinelocationMods.RandomWidthMeters(f), HistoryLinelocationMods.RandomZone(f), HistoryLinelocationMods.RandomZone2(f), + HistoryLinelocationMods.RandomCreated(f), HistoryLinelocationMods.RandomCreatedDate(f), HistoryLinelocationMods.RandomCreatedUser(f), HistoryLinelocationMods.RandomGeometryX(f), @@ -715,14 +729,14 @@ func (m historyLinelocationMods) RandomizeAllColumns(f *faker.Faker) HistoryLine } // Set the model columns to this value -func (m historyLinelocationMods) OrganizationID(val null.Val[int32]) HistoryLinelocationMod { +func (m historyLinelocationMods) OrganizationID(val int32) HistoryLinelocationMod { return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyLinelocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryLinelocationMod { +func (m historyLinelocationMods) OrganizationIDFunc(f func() int32) HistoryLinelocationMod { return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { o.OrganizationID = f }) @@ -737,32 +751,10 @@ func (m historyLinelocationMods) UnsetOrganizationID() HistoryLinelocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyLinelocationMods) RandomOrganizationID(f *faker.Faker) HistoryLinelocationMod { return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyLinelocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -3077,6 +3069,59 @@ func (m historyLinelocationMods) RandomZone2NotNull(f *faker.Faker) HistoryLinel }) } +// Set the model columns to this value +func (m historyLinelocationMods) Created(val null.Val[time.Time]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyLinelocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyLinelocationMods) UnsetCreated() HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyLinelocationMods) RandomCreated(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyLinelocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryLinelocationMod { + return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyLinelocationMods) CreatedDate(val null.Val[int64]) HistoryLinelocationMod { return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { diff --git a/factory/history_locationtracking.bob.go b/factory/history_locationtracking.bob.go index 992c40ef..b948af35 100644 --- a/factory/history_locationtracking.bob.go +++ b/factory/history_locationtracking.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryLocationtrackingModSlice) Apply(ctx context.Context, n *Histor // HistoryLocationtrackingTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryLocationtrackingTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accuracy func() null.Val[float64] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -45,6 +46,7 @@ type HistoryLocationtrackingTemplate struct { Fieldtech func() null.Val[string] Globalid func() null.Val[string] Objectid func() int32 + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -80,7 +82,7 @@ func (t HistoryLocationtrackingTemplate) setModelRels(o *models.HistoryLocationt if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryLocationtrackings = append(rel.R.HistoryLocationtrackings, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -92,7 +94,7 @@ func (o HistoryLocationtrackingTemplate) BuildSetter() *models.HistoryLocationtr if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accuracy != nil { val := o.Accuracy() @@ -126,6 +128,10 @@ func (o HistoryLocationtrackingTemplate) BuildSetter() *models.HistoryLocationtr val := o.Objectid() m.Objectid = omit.From(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -203,6 +209,9 @@ func (o HistoryLocationtrackingTemplate) Build() *models.HistoryLocationtracking if o.Objectid != nil { m.Objectid = o.Objectid() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -244,6 +253,10 @@ func (o HistoryLocationtrackingTemplate) BuildMany(number int) models.HistoryLoc } func ensureCreatableHistoryLocationtracking(m *models.HistoryLocationtrackingSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -260,25 +273,6 @@ func ensureCreatableHistoryLocationtracking(m *models.HistoryLocationtrackingSet func (o *HistoryLocationtrackingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryLocationtracking) error { var err error - isOrganizationDone, _ := historyLocationtrackingRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyLocationtrackingRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -289,11 +283,30 @@ func (o *HistoryLocationtrackingTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableHistoryLocationtracking(opt) + if o.r.Organization == nil { + HistoryLocationtrackingMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryLocationtrackings.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -380,6 +393,7 @@ func (m historyLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) History HistoryLocationtrackingMods.RandomFieldtech(f), HistoryLocationtrackingMods.RandomGlobalid(f), HistoryLocationtrackingMods.RandomObjectid(f), + HistoryLocationtrackingMods.RandomCreated(f), HistoryLocationtrackingMods.RandomCreatedDate(f), HistoryLocationtrackingMods.RandomCreatedUser(f), HistoryLocationtrackingMods.RandomGeometryX(f), @@ -391,14 +405,14 @@ func (m historyLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) History } // Set the model columns to this value -func (m historyLocationtrackingMods) OrganizationID(val null.Val[int32]) HistoryLocationtrackingMod { +func (m historyLocationtrackingMods) OrganizationID(val int32) HistoryLocationtrackingMod { return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyLocationtrackingMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryLocationtrackingMod { +func (m historyLocationtrackingMods) OrganizationIDFunc(f func() int32) HistoryLocationtrackingMod { return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { o.OrganizationID = f }) @@ -413,32 +427,10 @@ func (m historyLocationtrackingMods) UnsetOrganizationID() HistoryLocationtracki // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyLocationtrackingMods) RandomOrganizationID(f *faker.Faker) HistoryLocationtrackingMod { return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyLocationtrackingMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -845,6 +837,59 @@ func (m historyLocationtrackingMods) RandomObjectid(f *faker.Faker) HistoryLocat }) } +// Set the model columns to this value +func (m historyLocationtrackingMods) Created(val null.Val[time.Time]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyLocationtrackingMods) CreatedFunc(f func() null.Val[time.Time]) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyLocationtrackingMods) UnsetCreated() HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyLocationtrackingMods) RandomCreated(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyLocationtrackingMods) RandomCreatedNotNull(f *faker.Faker) HistoryLocationtrackingMod { + return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyLocationtrackingMods) CreatedDate(val null.Val[int64]) HistoryLocationtrackingMod { return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { diff --git a/factory/history_mosquitoinspection.bob.go b/factory/history_mosquitoinspection.bob.go index 1d333283..c9482796 100644 --- a/factory/history_mosquitoinspection.bob.go +++ b/factory/history_mosquitoinspection.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryMosquitoinspectionModSlice) Apply(ctx context.Context, n *Hist // HistoryMosquitoinspectionTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryMosquitoinspectionTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Actiontaken func() null.Val[string] Activity func() null.Val[string] Adultact func() null.Val[string] @@ -88,6 +89,7 @@ type HistoryMosquitoinspectionTemplate struct { Windspeed func() null.Val[float64] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -125,7 +127,7 @@ func (t HistoryMosquitoinspectionTemplate) setModelRels(o *models.HistoryMosquit if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryMosquitoinspections = append(rel.R.HistoryMosquitoinspections, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -137,7 +139,7 @@ func (o HistoryMosquitoinspectionTemplate) BuildSetter() *models.HistoryMosquito if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Actiontaken != nil { val := o.Actiontaken() @@ -343,6 +345,10 @@ func (o HistoryMosquitoinspectionTemplate) BuildSetter() *models.HistoryMosquito val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -557,6 +563,9 @@ func (o HistoryMosquitoinspectionTemplate) Build() *models.HistoryMosquitoinspec if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -604,6 +613,10 @@ func (o HistoryMosquitoinspectionTemplate) BuildMany(number int) models.HistoryM } func ensureCreatableHistoryMosquitoinspection(m *models.HistoryMosquitoinspectionSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -620,25 +633,6 @@ func ensureCreatableHistoryMosquitoinspection(m *models.HistoryMosquitoinspectio func (o *HistoryMosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryMosquitoinspection) error { var err error - isOrganizationDone, _ := historyMosquitoinspectionRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyMosquitoinspectionRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -649,11 +643,30 @@ func (o *HistoryMosquitoinspectionTemplate) Create(ctx context.Context, exec bob opt := o.BuildSetter() ensureCreatableHistoryMosquitoinspection(opt) + if o.r.Organization == nil { + HistoryMosquitoinspectionMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryMosquitoinspections.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -783,6 +796,7 @@ func (m historyMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) Histo HistoryMosquitoinspectionMods.RandomWindspeed(f), HistoryMosquitoinspectionMods.RandomZone(f), HistoryMosquitoinspectionMods.RandomZone2(f), + HistoryMosquitoinspectionMods.RandomCreated(f), HistoryMosquitoinspectionMods.RandomCreatedDate(f), HistoryMosquitoinspectionMods.RandomCreatedUser(f), HistoryMosquitoinspectionMods.RandomGeometryX(f), @@ -796,14 +810,14 @@ func (m historyMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) Histo } // Set the model columns to this value -func (m historyMosquitoinspectionMods) OrganizationID(val null.Val[int32]) HistoryMosquitoinspectionMod { +func (m historyMosquitoinspectionMods) OrganizationID(val int32) HistoryMosquitoinspectionMod { return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyMosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryMosquitoinspectionMod { +func (m historyMosquitoinspectionMods) OrganizationIDFunc(f func() int32) HistoryMosquitoinspectionMod { return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { o.OrganizationID = f }) @@ -818,32 +832,10 @@ func (m historyMosquitoinspectionMods) UnsetOrganizationID() HistoryMosquitoinsp // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyMosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) HistoryMosquitoinspectionMod { return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyMosquitoinspectionMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -3529,6 +3521,59 @@ func (m historyMosquitoinspectionMods) RandomZone2NotNull(f *faker.Faker) Histor }) } +// Set the model columns to this value +func (m historyMosquitoinspectionMods) Created(val null.Val[time.Time]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyMosquitoinspectionMods) CreatedFunc(f func() null.Val[time.Time]) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyMosquitoinspectionMods) UnsetCreated() HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyMosquitoinspectionMods) RandomCreated(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyMosquitoinspectionMods) RandomCreatedNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { + return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyMosquitoinspectionMods) CreatedDate(val null.Val[int64]) HistoryMosquitoinspectionMod { return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { diff --git a/factory/history_pointlocation.bob.go b/factory/history_pointlocation.bob.go index e5f6c1b5..4bbf27b2 100644 --- a/factory/history_pointlocation.bob.go +++ b/factory/history_pointlocation.bob.go @@ -36,7 +36,7 @@ func (mods HistoryPointlocationModSlice) Apply(ctx context.Context, n *HistoryPo // HistoryPointlocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryPointlocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -112,7 +112,7 @@ func (t HistoryPointlocationTemplate) setModelRels(o *models.HistoryPointlocatio if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryPointlocations = append(rel.R.HistoryPointlocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -124,7 +124,7 @@ func (o HistoryPointlocationTemplate) BuildSetter() *models.HistoryPointlocation if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -500,6 +500,10 @@ func (o HistoryPointlocationTemplate) BuildMany(number int) models.HistoryPointl } func ensureCreatableHistoryPointlocation(m *models.HistoryPointlocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -516,25 +520,6 @@ func ensureCreatableHistoryPointlocation(m *models.HistoryPointlocationSetter) { func (o *HistoryPointlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPointlocation) error { var err error - isOrganizationDone, _ := historyPointlocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyPointlocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -545,11 +530,30 @@ func (o *HistoryPointlocationTemplate) Create(ctx context.Context, exec bob.Exec opt := o.BuildSetter() ensureCreatableHistoryPointlocation(opt) + if o.r.Organization == nil { + HistoryPointlocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryPointlocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -679,14 +683,14 @@ func (m historyPointlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryPoi } // Set the model columns to this value -func (m historyPointlocationMods) OrganizationID(val null.Val[int32]) HistoryPointlocationMod { +func (m historyPointlocationMods) OrganizationID(val int32) HistoryPointlocationMod { return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyPointlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPointlocationMod { +func (m historyPointlocationMods) OrganizationIDFunc(f func() int32) HistoryPointlocationMod { return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { o.OrganizationID = f }) @@ -701,32 +705,10 @@ func (m historyPointlocationMods) UnsetOrganizationID() HistoryPointlocationMod // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyPointlocationMods) RandomOrganizationID(f *faker.Faker) HistoryPointlocationMod { return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyPointlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/history_polygonlocation.bob.go b/factory/history_polygonlocation.bob.go index 3874cd15..8f9bb05b 100644 --- a/factory/history_polygonlocation.bob.go +++ b/factory/history_polygonlocation.bob.go @@ -36,7 +36,7 @@ func (mods HistoryPolygonlocationModSlice) Apply(ctx context.Context, n *History // HistoryPolygonlocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryPolygonlocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Acres func() null.Val[float64] Active func() null.Val[int16] @@ -110,7 +110,7 @@ func (t HistoryPolygonlocationTemplate) setModelRels(o *models.HistoryPolygonloc if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryPolygonlocations = append(rel.R.HistoryPolygonlocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -122,7 +122,7 @@ func (o HistoryPolygonlocationTemplate) BuildSetter() *models.HistoryPolygonloca if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -484,6 +484,10 @@ func (o HistoryPolygonlocationTemplate) BuildMany(number int) models.HistoryPoly } func ensureCreatableHistoryPolygonlocation(m *models.HistoryPolygonlocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -500,25 +504,6 @@ func ensureCreatableHistoryPolygonlocation(m *models.HistoryPolygonlocationSette func (o *HistoryPolygonlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPolygonlocation) error { var err error - isOrganizationDone, _ := historyPolygonlocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyPolygonlocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -529,11 +514,30 @@ func (o *HistoryPolygonlocationTemplate) Create(ctx context.Context, exec bob.Ex opt := o.BuildSetter() ensureCreatableHistoryPolygonlocation(opt) + if o.r.Organization == nil { + HistoryPolygonlocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryPolygonlocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -661,14 +665,14 @@ func (m historyPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryP } // Set the model columns to this value -func (m historyPolygonlocationMods) OrganizationID(val null.Val[int32]) HistoryPolygonlocationMod { +func (m historyPolygonlocationMods) OrganizationID(val int32) HistoryPolygonlocationMod { return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyPolygonlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPolygonlocationMod { +func (m historyPolygonlocationMods) OrganizationIDFunc(f func() int32) HistoryPolygonlocationMod { return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { o.OrganizationID = f }) @@ -683,32 +687,10 @@ func (m historyPolygonlocationMods) UnsetOrganizationID() HistoryPolygonlocation // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyPolygonlocationMods) RandomOrganizationID(f *faker.Faker) HistoryPolygonlocationMod { return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyPolygonlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/history_pool.bob.go b/factory/history_pool.bob.go index 888262a4..a61b9f81 100644 --- a/factory/history_pool.bob.go +++ b/factory/history_pool.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryPoolModSlice) Apply(ctx context.Context, n *HistoryPoolTemplat // HistoryPoolTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryPoolTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Comments func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -58,6 +59,7 @@ type HistoryPoolTemplate struct { Testmethod func() null.Val[string] Testtech func() null.Val[string] TrapdataID func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -96,7 +98,7 @@ func (t HistoryPoolTemplate) setModelRels(o *models.HistoryPool) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryPools = append(rel.R.HistoryPools, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -108,7 +110,7 @@ func (o HistoryPoolTemplate) BuildSetter() *models.HistoryPoolSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Comments != nil { val := o.Comments() @@ -194,6 +196,10 @@ func (o HistoryPoolTemplate) BuildSetter() *models.HistoryPoolSetter { val := o.TrapdataID() m.TrapdataID = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -322,6 +328,9 @@ func (o HistoryPoolTemplate) Build() *models.HistoryPool { if o.TrapdataID != nil { m.TrapdataID = o.TrapdataID() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -372,6 +381,10 @@ func (o HistoryPoolTemplate) BuildMany(number int) models.HistoryPoolSlice { } func ensureCreatableHistoryPool(m *models.HistoryPoolSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -388,25 +401,6 @@ func ensureCreatableHistoryPool(m *models.HistoryPoolSetter) { func (o *HistoryPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPool) error { var err error - isOrganizationDone, _ := historyPoolRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyPoolRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -417,11 +411,30 @@ func (o *HistoryPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*m opt := o.BuildSetter() ensureCreatableHistoryPool(opt) + if o.r.Organization == nil { + HistoryPoolMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryPools.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -521,6 +534,7 @@ func (m historyPoolMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolMod { HistoryPoolMods.RandomTestmethod(f), HistoryPoolMods.RandomTesttech(f), HistoryPoolMods.RandomTrapdataID(f), + HistoryPoolMods.RandomCreated(f), HistoryPoolMods.RandomCreatedDate(f), HistoryPoolMods.RandomCreatedUser(f), HistoryPoolMods.RandomGeometryX(f), @@ -535,14 +549,14 @@ func (m historyPoolMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolMod { } // Set the model columns to this value -func (m historyPoolMods) OrganizationID(val null.Val[int32]) HistoryPoolMod { +func (m historyPoolMods) OrganizationID(val int32) HistoryPoolMod { return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyPoolMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPoolMod { +func (m historyPoolMods) OrganizationIDFunc(f func() int32) HistoryPoolMod { return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { o.OrganizationID = f }) @@ -557,32 +571,10 @@ func (m historyPoolMods) UnsetOrganizationID() HistoryPoolMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyPoolMods) RandomOrganizationID(f *faker.Faker) HistoryPoolMod { return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyPoolMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1678,6 +1670,59 @@ func (m historyPoolMods) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPoolMod }) } +// Set the model columns to this value +func (m historyPoolMods) Created(val null.Val[time.Time]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyPoolMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyPoolMods) UnsetCreated() HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyPoolMods) RandomCreated(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyPoolMods) RandomCreatedNotNull(f *faker.Faker) HistoryPoolMod { + return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyPoolMods) CreatedDate(val null.Val[int64]) HistoryPoolMod { return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { diff --git a/factory/history_pooldetail.bob.go b/factory/history_pooldetail.bob.go index 54deeee2..346b03c2 100644 --- a/factory/history_pooldetail.bob.go +++ b/factory/history_pooldetail.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryPooldetailModSlice) Apply(ctx context.Context, n *HistoryPoold // HistoryPooldetailTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryPooldetailTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -47,6 +48,7 @@ type HistoryPooldetailTemplate struct { PoolID func() null.Val[string] Species func() null.Val[string] TrapdataID func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -82,7 +84,7 @@ func (t HistoryPooldetailTemplate) setModelRels(o *models.HistoryPooldetail) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryPooldetails = append(rel.R.HistoryPooldetails, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -94,7 +96,7 @@ func (o HistoryPooldetailTemplate) BuildSetter() *models.HistoryPooldetailSetter if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -136,6 +138,10 @@ func (o HistoryPooldetailTemplate) BuildSetter() *models.HistoryPooldetailSetter val := o.TrapdataID() m.TrapdataID = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -219,6 +225,9 @@ func (o HistoryPooldetailTemplate) Build() *models.HistoryPooldetail { if o.TrapdataID != nil { m.TrapdataID = o.TrapdataID() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -260,6 +269,10 @@ func (o HistoryPooldetailTemplate) BuildMany(number int) models.HistoryPooldetai } func ensureCreatableHistoryPooldetail(m *models.HistoryPooldetailSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -276,25 +289,6 @@ func ensureCreatableHistoryPooldetail(m *models.HistoryPooldetailSetter) { func (o *HistoryPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPooldetail) error { var err error - isOrganizationDone, _ := historyPooldetailRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyPooldetailRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -305,11 +299,30 @@ func (o *HistoryPooldetailTemplate) Create(ctx context.Context, exec bob.Executo opt := o.BuildSetter() ensureCreatableHistoryPooldetail(opt) + if o.r.Organization == nil { + HistoryPooldetailMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryPooldetails.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -398,6 +411,7 @@ func (m historyPooldetailMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolde HistoryPooldetailMods.RandomPoolID(f), HistoryPooldetailMods.RandomSpecies(f), HistoryPooldetailMods.RandomTrapdataID(f), + HistoryPooldetailMods.RandomCreated(f), HistoryPooldetailMods.RandomCreatedDate(f), HistoryPooldetailMods.RandomCreatedUser(f), HistoryPooldetailMods.RandomGeometryX(f), @@ -409,14 +423,14 @@ func (m historyPooldetailMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolde } // Set the model columns to this value -func (m historyPooldetailMods) OrganizationID(val null.Val[int32]) HistoryPooldetailMod { +func (m historyPooldetailMods) OrganizationID(val int32) HistoryPooldetailMod { return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyPooldetailMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPooldetailMod { +func (m historyPooldetailMods) OrganizationIDFunc(f func() int32) HistoryPooldetailMod { return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { o.OrganizationID = f }) @@ -431,32 +445,10 @@ func (m historyPooldetailMods) UnsetOrganizationID() HistoryPooldetailMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyPooldetailMods) RandomOrganizationID(f *faker.Faker) HistoryPooldetailMod { return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyPooldetailMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -969,6 +961,59 @@ func (m historyPooldetailMods) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPo }) } +// Set the model columns to this value +func (m historyPooldetailMods) Created(val null.Val[time.Time]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyPooldetailMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyPooldetailMods) UnsetCreated() HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyPooldetailMods) RandomCreated(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyPooldetailMods) RandomCreatedNotNull(f *faker.Faker) HistoryPooldetailMod { + return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyPooldetailMods) CreatedDate(val null.Val[int64]) HistoryPooldetailMod { return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { diff --git a/factory/history_proposedtreatmentarea.bob.go b/factory/history_proposedtreatmentarea.bob.go index f539f42c..09870cba 100644 --- a/factory/history_proposedtreatmentarea.bob.go +++ b/factory/history_proposedtreatmentarea.bob.go @@ -36,7 +36,7 @@ func (mods HistoryProposedtreatmentareaModSlice) Apply(ctx context.Context, n *H // HistoryProposedtreatmentareaTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryProposedtreatmentareaTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Acres func() null.Val[float64] Comments func() null.Val[string] Completed func() null.Val[int16] @@ -101,7 +101,7 @@ func (t HistoryProposedtreatmentareaTemplate) setModelRels(o *models.HistoryProp if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryProposedtreatmentareas = append(rel.R.HistoryProposedtreatmentareas, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -113,7 +113,7 @@ func (o HistoryProposedtreatmentareaTemplate) BuildSetter() *models.HistoryPropo if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Acres != nil { val := o.Acres() @@ -412,6 +412,10 @@ func (o HistoryProposedtreatmentareaTemplate) BuildMany(number int) models.Histo } func ensureCreatableHistoryProposedtreatmentarea(m *models.HistoryProposedtreatmentareaSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -428,25 +432,6 @@ func ensureCreatableHistoryProposedtreatmentarea(m *models.HistoryProposedtreatm func (o *HistoryProposedtreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryProposedtreatmentarea) error { var err error - isOrganizationDone, _ := historyProposedtreatmentareaRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyProposedtreatmentareaRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -457,11 +442,30 @@ func (o *HistoryProposedtreatmentareaTemplate) Create(ctx context.Context, exec opt := o.BuildSetter() ensureCreatableHistoryProposedtreatmentarea(opt) + if o.r.Organization == nil { + HistoryProposedtreatmentareaMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryProposedtreatmentareas.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -580,14 +584,14 @@ func (m historyProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) Hi } // Set the model columns to this value -func (m historyProposedtreatmentareaMods) OrganizationID(val null.Val[int32]) HistoryProposedtreatmentareaMod { +func (m historyProposedtreatmentareaMods) OrganizationID(val int32) HistoryProposedtreatmentareaMod { return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyProposedtreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryProposedtreatmentareaMod { +func (m historyProposedtreatmentareaMods) OrganizationIDFunc(f func() int32) HistoryProposedtreatmentareaMod { return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { o.OrganizationID = f }) @@ -602,32 +606,10 @@ func (m historyProposedtreatmentareaMods) UnsetOrganizationID() HistoryProposedt // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyProposedtreatmentareaMods) RandomOrganizationID(f *faker.Faker) HistoryProposedtreatmentareaMod { return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyProposedtreatmentareaMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/history_qamosquitoinspection.bob.go b/factory/history_qamosquitoinspection.bob.go index f4c84aee..a7c17a67 100644 --- a/factory/history_qamosquitoinspection.bob.go +++ b/factory/history_qamosquitoinspection.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryQamosquitoinspectionModSlice) Apply(ctx context.Context, n *Hi // HistoryQamosquitoinspectionTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryQamosquitoinspectionTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Acresbreeding func() null.Val[float64] Actiontaken func() null.Val[string] Adultactivity func() null.Val[int16] @@ -95,6 +96,7 @@ type HistoryQamosquitoinspectionTemplate struct { Windspeed func() null.Val[float64] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -130,7 +132,7 @@ func (t HistoryQamosquitoinspectionTemplate) setModelRels(o *models.HistoryQamos if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryQamosquitoinspections = append(rel.R.HistoryQamosquitoinspections, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -142,7 +144,7 @@ func (o HistoryQamosquitoinspectionTemplate) BuildSetter() *models.HistoryQamosq if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Acresbreeding != nil { val := o.Acresbreeding() @@ -376,6 +378,10 @@ func (o HistoryQamosquitoinspectionTemplate) BuildSetter() *models.HistoryQamosq val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -603,6 +609,9 @@ func (o HistoryQamosquitoinspectionTemplate) Build() *models.HistoryQamosquitoin if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -644,6 +653,10 @@ func (o HistoryQamosquitoinspectionTemplate) BuildMany(number int) models.Histor } func ensureCreatableHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspectionSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -660,25 +673,6 @@ func ensureCreatableHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspe func (o *HistoryQamosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryQamosquitoinspection) error { var err error - isOrganizationDone, _ := historyQamosquitoinspectionRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyQamosquitoinspectionRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -689,11 +683,30 @@ func (o *HistoryQamosquitoinspectionTemplate) Create(ctx context.Context, exec b opt := o.BuildSetter() ensureCreatableHistoryQamosquitoinspection(opt) + if o.r.Organization == nil { + HistoryQamosquitoinspectionMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryQamosquitoinspections.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -830,6 +843,7 @@ func (m historyQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) His HistoryQamosquitoinspectionMods.RandomWindspeed(f), HistoryQamosquitoinspectionMods.RandomZone(f), HistoryQamosquitoinspectionMods.RandomZone2(f), + HistoryQamosquitoinspectionMods.RandomCreated(f), HistoryQamosquitoinspectionMods.RandomCreatedDate(f), HistoryQamosquitoinspectionMods.RandomCreatedUser(f), HistoryQamosquitoinspectionMods.RandomGeometryX(f), @@ -841,14 +855,14 @@ func (m historyQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) His } // Set the model columns to this value -func (m historyQamosquitoinspectionMods) OrganizationID(val null.Val[int32]) HistoryQamosquitoinspectionMod { +func (m historyQamosquitoinspectionMods) OrganizationID(val int32) HistoryQamosquitoinspectionMod { return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyQamosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryQamosquitoinspectionMod { +func (m historyQamosquitoinspectionMods) OrganizationIDFunc(f func() int32) HistoryQamosquitoinspectionMod { return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { o.OrganizationID = f }) @@ -863,32 +877,10 @@ func (m historyQamosquitoinspectionMods) UnsetOrganizationID() HistoryQamosquito // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyQamosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) HistoryQamosquitoinspectionMod { return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyQamosquitoinspectionMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -3945,6 +3937,59 @@ func (m historyQamosquitoinspectionMods) RandomZone2NotNull(f *faker.Faker) Hist }) } +// Set the model columns to this value +func (m historyQamosquitoinspectionMods) Created(val null.Val[time.Time]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyQamosquitoinspectionMods) CreatedFunc(f func() null.Val[time.Time]) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyQamosquitoinspectionMods) UnsetCreated() HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyQamosquitoinspectionMods) RandomCreated(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyQamosquitoinspectionMods) RandomCreatedNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { + return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyQamosquitoinspectionMods) CreatedDate(val null.Val[int64]) HistoryQamosquitoinspectionMod { return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { diff --git a/factory/history_rodentlocation.bob.go b/factory/history_rodentlocation.bob.go index 4bf25520..996cefc8 100644 --- a/factory/history_rodentlocation.bob.go +++ b/factory/history_rodentlocation.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryRodentlocationModSlice) Apply(ctx context.Context, n *HistoryR // HistoryRodentlocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryRodentlocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -62,6 +63,7 @@ type HistoryRodentlocationTemplate struct { Usetype func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -98,7 +100,7 @@ func (t HistoryRodentlocationTemplate) setModelRels(o *models.HistoryRodentlocat if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryRodentlocations = append(rel.R.HistoryRodentlocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -110,7 +112,7 @@ func (o HistoryRodentlocationTemplate) BuildSetter() *models.HistoryRodentlocati if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -212,6 +214,10 @@ func (o HistoryRodentlocationTemplate) BuildSetter() *models.HistoryRodentlocati val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -344,6 +350,9 @@ func (o HistoryRodentlocationTemplate) Build() *models.HistoryRodentlocation { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -388,6 +397,10 @@ func (o HistoryRodentlocationTemplate) BuildMany(number int) models.HistoryRoden } func ensureCreatableHistoryRodentlocation(m *models.HistoryRodentlocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -404,25 +417,6 @@ func ensureCreatableHistoryRodentlocation(m *models.HistoryRodentlocationSetter) func (o *HistoryRodentlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryRodentlocation) error { var err error - isOrganizationDone, _ := historyRodentlocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyRodentlocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -433,11 +427,30 @@ func (o *HistoryRodentlocationTemplate) Create(ctx context.Context, exec bob.Exe opt := o.BuildSetter() ensureCreatableHistoryRodentlocation(opt) + if o.r.Organization == nil { + HistoryRodentlocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryRodentlocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -541,6 +554,7 @@ func (m historyRodentlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryRo HistoryRodentlocationMods.RandomUsetype(f), HistoryRodentlocationMods.RandomZone(f), HistoryRodentlocationMods.RandomZone2(f), + HistoryRodentlocationMods.RandomCreated(f), HistoryRodentlocationMods.RandomCreatedDate(f), HistoryRodentlocationMods.RandomCreatedUser(f), HistoryRodentlocationMods.RandomGeometryX(f), @@ -553,14 +567,14 @@ func (m historyRodentlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryRo } // Set the model columns to this value -func (m historyRodentlocationMods) OrganizationID(val null.Val[int32]) HistoryRodentlocationMod { +func (m historyRodentlocationMods) OrganizationID(val int32) HistoryRodentlocationMod { return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyRodentlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryRodentlocationMod { +func (m historyRodentlocationMods) OrganizationIDFunc(f func() int32) HistoryRodentlocationMod { return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { o.OrganizationID = f }) @@ -575,32 +589,10 @@ func (m historyRodentlocationMods) UnsetOrganizationID() HistoryRodentlocationMo // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyRodentlocationMods) RandomOrganizationID(f *faker.Faker) HistoryRodentlocationMod { return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyRodentlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1908,6 +1900,59 @@ func (m historyRodentlocationMods) RandomZone2NotNull(f *faker.Faker) HistoryRod }) } +// Set the model columns to this value +func (m historyRodentlocationMods) Created(val null.Val[time.Time]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyRodentlocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyRodentlocationMods) UnsetCreated() HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyRodentlocationMods) RandomCreated(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyRodentlocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryRodentlocationMod { + return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyRodentlocationMods) CreatedDate(val null.Val[int64]) HistoryRodentlocationMod { return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { diff --git a/factory/history_samplecollection.bob.go b/factory/history_samplecollection.bob.go index e652835b..8d00ab86 100644 --- a/factory/history_samplecollection.bob.go +++ b/factory/history_samplecollection.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistorySamplecollectionModSlice) Apply(ctx context.Context, n *Histor // HistorySamplecollectionTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistorySamplecollectionTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Activity func() null.Val[string] Avetemp func() null.Val[float64] Chickenid func() null.Val[string] @@ -79,6 +80,7 @@ type HistorySamplecollectionTemplate struct { Windspeed func() null.Val[float64] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -114,7 +116,7 @@ func (t HistorySamplecollectionTemplate) setModelRels(o *models.HistorySamplecol if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistorySamplecollections = append(rel.R.HistorySamplecollections, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -126,7 +128,7 @@ func (o HistorySamplecollectionTemplate) BuildSetter() *models.HistorySamplecoll if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Activity != nil { val := o.Activity() @@ -296,6 +298,10 @@ func (o HistorySamplecollectionTemplate) BuildSetter() *models.HistorySamplecoll val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -475,6 +481,9 @@ func (o HistorySamplecollectionTemplate) Build() *models.HistorySamplecollection if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -516,6 +525,10 @@ func (o HistorySamplecollectionTemplate) BuildMany(number int) models.HistorySam } func ensureCreatableHistorySamplecollection(m *models.HistorySamplecollectionSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -532,25 +545,6 @@ func ensureCreatableHistorySamplecollection(m *models.HistorySamplecollectionSet func (o *HistorySamplecollectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistorySamplecollection) error { var err error - isOrganizationDone, _ := historySamplecollectionRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historySamplecollectionRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -561,11 +555,30 @@ func (o *HistorySamplecollectionTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableHistorySamplecollection(opt) + if o.r.Organization == nil { + HistorySamplecollectionMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistorySamplecollections.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -686,6 +699,7 @@ func (m historySamplecollectionMods) RandomizeAllColumns(f *faker.Faker) History HistorySamplecollectionMods.RandomWindspeed(f), HistorySamplecollectionMods.RandomZone(f), HistorySamplecollectionMods.RandomZone2(f), + HistorySamplecollectionMods.RandomCreated(f), HistorySamplecollectionMods.RandomCreatedDate(f), HistorySamplecollectionMods.RandomCreatedUser(f), HistorySamplecollectionMods.RandomGeometryX(f), @@ -697,14 +711,14 @@ func (m historySamplecollectionMods) RandomizeAllColumns(f *faker.Faker) History } // Set the model columns to this value -func (m historySamplecollectionMods) OrganizationID(val null.Val[int32]) HistorySamplecollectionMod { +func (m historySamplecollectionMods) OrganizationID(val int32) HistorySamplecollectionMod { return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historySamplecollectionMods) OrganizationIDFunc(f func() null.Val[int32]) HistorySamplecollectionMod { +func (m historySamplecollectionMods) OrganizationIDFunc(f func() int32) HistorySamplecollectionMod { return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { o.OrganizationID = f }) @@ -719,32 +733,10 @@ func (m historySamplecollectionMods) UnsetOrganizationID() HistorySamplecollecti // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historySamplecollectionMods) RandomOrganizationID(f *faker.Faker) HistorySamplecollectionMod { return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historySamplecollectionMods) RandomOrganizationIDNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -2953,6 +2945,59 @@ func (m historySamplecollectionMods) RandomZone2NotNull(f *faker.Faker) HistoryS }) } +// Set the model columns to this value +func (m historySamplecollectionMods) Created(val null.Val[time.Time]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historySamplecollectionMods) CreatedFunc(f func() null.Val[time.Time]) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historySamplecollectionMods) UnsetCreated() HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historySamplecollectionMods) RandomCreated(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historySamplecollectionMods) RandomCreatedNotNull(f *faker.Faker) HistorySamplecollectionMod { + return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historySamplecollectionMods) CreatedDate(val null.Val[int64]) HistorySamplecollectionMod { return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { diff --git a/factory/history_samplelocation.bob.go b/factory/history_samplelocation.bob.go index e4a58586..69c8b330 100644 --- a/factory/history_samplelocation.bob.go +++ b/factory/history_samplelocation.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistorySamplelocationModSlice) Apply(ctx context.Context, n *HistoryS // HistorySamplelocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistorySamplelocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -57,6 +58,7 @@ type HistorySamplelocationTemplate struct { Usetype func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -92,7 +94,7 @@ func (t HistorySamplelocationTemplate) setModelRels(o *models.HistorySamplelocat if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistorySamplelocations = append(rel.R.HistorySamplelocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -104,7 +106,7 @@ func (o HistorySamplelocationTemplate) BuildSetter() *models.HistorySamplelocati if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -186,6 +188,10 @@ func (o HistorySamplelocationTemplate) BuildSetter() *models.HistorySamplelocati val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -299,6 +305,9 @@ func (o HistorySamplelocationTemplate) Build() *models.HistorySamplelocation { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -340,6 +349,10 @@ func (o HistorySamplelocationTemplate) BuildMany(number int) models.HistorySampl } func ensureCreatableHistorySamplelocation(m *models.HistorySamplelocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -356,25 +369,6 @@ func ensureCreatableHistorySamplelocation(m *models.HistorySamplelocationSetter) func (o *HistorySamplelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistorySamplelocation) error { var err error - isOrganizationDone, _ := historySamplelocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historySamplelocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -385,11 +379,30 @@ func (o *HistorySamplelocationTemplate) Create(ctx context.Context, exec bob.Exe opt := o.BuildSetter() ensureCreatableHistorySamplelocation(opt) + if o.r.Organization == nil { + HistorySamplelocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistorySamplelocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -488,6 +501,7 @@ func (m historySamplelocationMods) RandomizeAllColumns(f *faker.Faker) HistorySa HistorySamplelocationMods.RandomUsetype(f), HistorySamplelocationMods.RandomZone(f), HistorySamplelocationMods.RandomZone2(f), + HistorySamplelocationMods.RandomCreated(f), HistorySamplelocationMods.RandomCreatedDate(f), HistorySamplelocationMods.RandomCreatedUser(f), HistorySamplelocationMods.RandomGeometryX(f), @@ -499,14 +513,14 @@ func (m historySamplelocationMods) RandomizeAllColumns(f *faker.Faker) HistorySa } // Set the model columns to this value -func (m historySamplelocationMods) OrganizationID(val null.Val[int32]) HistorySamplelocationMod { +func (m historySamplelocationMods) OrganizationID(val int32) HistorySamplelocationMod { return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historySamplelocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistorySamplelocationMod { +func (m historySamplelocationMods) OrganizationIDFunc(f func() int32) HistorySamplelocationMod { return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { o.OrganizationID = f }) @@ -521,32 +535,10 @@ func (m historySamplelocationMods) UnsetOrganizationID() HistorySamplelocationMo // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historySamplelocationMods) RandomOrganizationID(f *faker.Faker) HistorySamplelocationMod { return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historySamplelocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1589,6 +1581,59 @@ func (m historySamplelocationMods) RandomZone2NotNull(f *faker.Faker) HistorySam }) } +// Set the model columns to this value +func (m historySamplelocationMods) Created(val null.Val[time.Time]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historySamplelocationMods) CreatedFunc(f func() null.Val[time.Time]) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historySamplelocationMods) UnsetCreated() HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historySamplelocationMods) RandomCreated(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historySamplelocationMods) RandomCreatedNotNull(f *faker.Faker) HistorySamplelocationMod { + return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historySamplelocationMods) CreatedDate(val null.Val[int64]) HistorySamplelocationMod { return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { diff --git a/factory/history_servicerequest.bob.go b/factory/history_servicerequest.bob.go index 4960af7b..2ce2016f 100644 --- a/factory/history_servicerequest.bob.go +++ b/factory/history_servicerequest.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryServicerequestModSlice) Apply(ctx context.Context, n *HistoryS // HistoryServicerequestTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryServicerequestTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accepted func() null.Val[int16] Acceptedby func() null.Val[string] Accepteddate func() null.Val[int64] @@ -115,6 +116,7 @@ type HistoryServicerequestTemplate struct { Yvalue func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -154,7 +156,7 @@ func (t HistoryServicerequestTemplate) setModelRels(o *models.HistoryServicerequ if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryServicerequests = append(rel.R.HistoryServicerequests, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -166,7 +168,7 @@ func (o HistoryServicerequestTemplate) BuildSetter() *models.HistoryServicereque if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accepted != nil { val := o.Accepted() @@ -480,6 +482,10 @@ func (o HistoryServicerequestTemplate) BuildSetter() *models.HistoryServicereque val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -783,6 +789,9 @@ func (o HistoryServicerequestTemplate) Build() *models.HistoryServicerequest { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -836,6 +845,10 @@ func (o HistoryServicerequestTemplate) BuildMany(number int) models.HistoryServi } func ensureCreatableHistoryServicerequest(m *models.HistoryServicerequestSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -852,25 +865,6 @@ func ensureCreatableHistoryServicerequest(m *models.HistoryServicerequestSetter) func (o *HistoryServicerequestTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryServicerequest) error { var err error - isOrganizationDone, _ := historyServicerequestRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyServicerequestRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -881,11 +875,30 @@ func (o *HistoryServicerequestTemplate) Create(ctx context.Context, exec bob.Exe opt := o.BuildSetter() ensureCreatableHistoryServicerequest(opt) + if o.r.Organization == nil { + HistoryServicerequestMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryServicerequests.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -1042,6 +1055,7 @@ func (m historyServicerequestMods) RandomizeAllColumns(f *faker.Faker) HistorySe HistoryServicerequestMods.RandomYvalue(f), HistoryServicerequestMods.RandomZone(f), HistoryServicerequestMods.RandomZone2(f), + HistoryServicerequestMods.RandomCreated(f), HistoryServicerequestMods.RandomCreatedDate(f), HistoryServicerequestMods.RandomCreatedUser(f), HistoryServicerequestMods.RandomGeometryX(f), @@ -1057,14 +1071,14 @@ func (m historyServicerequestMods) RandomizeAllColumns(f *faker.Faker) HistorySe } // Set the model columns to this value -func (m historyServicerequestMods) OrganizationID(val null.Val[int32]) HistoryServicerequestMod { +func (m historyServicerequestMods) OrganizationID(val int32) HistoryServicerequestMod { return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyServicerequestMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryServicerequestMod { +func (m historyServicerequestMods) OrganizationIDFunc(f func() int32) HistoryServicerequestMod { return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { o.OrganizationID = f }) @@ -1079,32 +1093,10 @@ func (m historyServicerequestMods) UnsetOrganizationID() HistoryServicerequestMo // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyServicerequestMods) RandomOrganizationID(f *faker.Faker) HistoryServicerequestMod { return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyServicerequestMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -5221,6 +5213,59 @@ func (m historyServicerequestMods) RandomZone2NotNull(f *faker.Faker) HistorySer }) } +// Set the model columns to this value +func (m historyServicerequestMods) Created(val null.Val[time.Time]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyServicerequestMods) CreatedFunc(f func() null.Val[time.Time]) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyServicerequestMods) UnsetCreated() HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyServicerequestMods) RandomCreated(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyServicerequestMods) RandomCreatedNotNull(f *faker.Faker) HistoryServicerequestMod { + return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyServicerequestMods) CreatedDate(val null.Val[int64]) HistoryServicerequestMod { return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { diff --git a/factory/history_speciesabundance.bob.go b/factory/history_speciesabundance.bob.go index 2e86487a..0ba449a6 100644 --- a/factory/history_speciesabundance.bob.go +++ b/factory/history_speciesabundance.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistorySpeciesabundanceModSlice) Apply(ctx context.Context, n *Histor // HistorySpeciesabundanceTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistorySpeciesabundanceTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Bloodedfem func() null.Val[int16] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -56,6 +57,7 @@ type HistorySpeciesabundanceTemplate struct { Total func() null.Val[int64] TrapdataID func() null.Val[string] Unknown func() null.Val[int16] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -97,7 +99,7 @@ func (t HistorySpeciesabundanceTemplate) setModelRels(o *models.HistorySpeciesab if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistorySpeciesabundances = append(rel.R.HistorySpeciesabundances, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -109,7 +111,7 @@ func (o HistorySpeciesabundanceTemplate) BuildSetter() *models.HistorySpeciesabu if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Bloodedfem != nil { val := o.Bloodedfem() @@ -187,6 +189,10 @@ func (o HistorySpeciesabundanceTemplate) BuildSetter() *models.HistorySpeciesabu val := o.Unknown() m.Unknown = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -321,6 +327,9 @@ func (o HistorySpeciesabundanceTemplate) Build() *models.HistorySpeciesabundance if o.Unknown != nil { m.Unknown = o.Unknown() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -380,6 +389,10 @@ func (o HistorySpeciesabundanceTemplate) BuildMany(number int) models.HistorySpe } func ensureCreatableHistorySpeciesabundance(m *models.HistorySpeciesabundanceSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -396,25 +409,6 @@ func ensureCreatableHistorySpeciesabundance(m *models.HistorySpeciesabundanceSet func (o *HistorySpeciesabundanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistorySpeciesabundance) error { var err error - isOrganizationDone, _ := historySpeciesabundanceRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historySpeciesabundanceRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -425,11 +419,30 @@ func (o *HistorySpeciesabundanceTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableHistorySpeciesabundance(opt) + if o.r.Organization == nil { + HistorySpeciesabundanceMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistorySpeciesabundances.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -527,6 +540,7 @@ func (m historySpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) History HistorySpeciesabundanceMods.RandomTotal(f), HistorySpeciesabundanceMods.RandomTrapdataID(f), HistorySpeciesabundanceMods.RandomUnknown(f), + HistorySpeciesabundanceMods.RandomCreated(f), HistorySpeciesabundanceMods.RandomCreatedDate(f), HistorySpeciesabundanceMods.RandomCreatedUser(f), HistorySpeciesabundanceMods.RandomGeometryX(f), @@ -544,14 +558,14 @@ func (m historySpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) History } // Set the model columns to this value -func (m historySpeciesabundanceMods) OrganizationID(val null.Val[int32]) HistorySpeciesabundanceMod { +func (m historySpeciesabundanceMods) OrganizationID(val int32) HistorySpeciesabundanceMod { return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historySpeciesabundanceMods) OrganizationIDFunc(f func() null.Val[int32]) HistorySpeciesabundanceMod { +func (m historySpeciesabundanceMods) OrganizationIDFunc(f func() int32) HistorySpeciesabundanceMod { return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { o.OrganizationID = f }) @@ -566,32 +580,10 @@ func (m historySpeciesabundanceMods) UnsetOrganizationID() HistorySpeciesabundan // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historySpeciesabundanceMods) RandomOrganizationID(f *faker.Faker) HistorySpeciesabundanceMod { return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historySpeciesabundanceMods) RandomOrganizationIDNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1581,6 +1573,59 @@ func (m historySpeciesabundanceMods) RandomUnknownNotNull(f *faker.Faker) Histor }) } +// Set the model columns to this value +func (m historySpeciesabundanceMods) Created(val null.Val[time.Time]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historySpeciesabundanceMods) CreatedFunc(f func() null.Val[time.Time]) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historySpeciesabundanceMods) UnsetCreated() HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historySpeciesabundanceMods) RandomCreated(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historySpeciesabundanceMods) RandomCreatedNotNull(f *faker.Faker) HistorySpeciesabundanceMod { + return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historySpeciesabundanceMods) CreatedDate(val null.Val[int64]) HistorySpeciesabundanceMod { return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { diff --git a/factory/history_stormdrain.bob.go b/factory/history_stormdrain.bob.go index e502564e..583145e7 100644 --- a/factory/history_stormdrain.bob.go +++ b/factory/history_stormdrain.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryStormdrainModSlice) Apply(ctx context.Context, n *HistoryStorm // HistoryStormdrainTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryStormdrainTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -52,6 +53,7 @@ type HistoryStormdrainTemplate struct { Type func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -87,7 +89,7 @@ func (t HistoryStormdrainTemplate) setModelRels(o *models.HistoryStormdrain) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryStormdrains = append(rel.R.HistoryStormdrains, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -99,7 +101,7 @@ func (o HistoryStormdrainTemplate) BuildSetter() *models.HistoryStormdrainSetter if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -161,6 +163,10 @@ func (o HistoryStormdrainTemplate) BuildSetter() *models.HistoryStormdrainSetter val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -259,6 +265,9 @@ func (o HistoryStormdrainTemplate) Build() *models.HistoryStormdrain { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -300,6 +309,10 @@ func (o HistoryStormdrainTemplate) BuildMany(number int) models.HistoryStormdrai } func ensureCreatableHistoryStormdrain(m *models.HistoryStormdrainSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -316,25 +329,6 @@ func ensureCreatableHistoryStormdrain(m *models.HistoryStormdrainSetter) { func (o *HistoryStormdrainTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryStormdrain) error { var err error - isOrganizationDone, _ := historyStormdrainRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyStormdrainRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -345,11 +339,30 @@ func (o *HistoryStormdrainTemplate) Create(ctx context.Context, exec bob.Executo opt := o.BuildSetter() ensureCreatableHistoryStormdrain(opt) + if o.r.Organization == nil { + HistoryStormdrainMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryStormdrains.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -443,6 +456,7 @@ func (m historyStormdrainMods) RandomizeAllColumns(f *faker.Faker) HistoryStormd HistoryStormdrainMods.RandomType(f), HistoryStormdrainMods.RandomZone(f), HistoryStormdrainMods.RandomZone2(f), + HistoryStormdrainMods.RandomCreated(f), HistoryStormdrainMods.RandomCreatedDate(f), HistoryStormdrainMods.RandomCreatedUser(f), HistoryStormdrainMods.RandomGeometryX(f), @@ -454,14 +468,14 @@ func (m historyStormdrainMods) RandomizeAllColumns(f *faker.Faker) HistoryStormd } // Set the model columns to this value -func (m historyStormdrainMods) OrganizationID(val null.Val[int32]) HistoryStormdrainMod { +func (m historyStormdrainMods) OrganizationID(val int32) HistoryStormdrainMod { return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyStormdrainMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryStormdrainMod { +func (m historyStormdrainMods) OrganizationIDFunc(f func() int32) HistoryStormdrainMod { return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { o.OrganizationID = f }) @@ -476,32 +490,10 @@ func (m historyStormdrainMods) UnsetOrganizationID() HistoryStormdrainMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyStormdrainMods) RandomOrganizationID(f *faker.Faker) HistoryStormdrainMod { return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyStormdrainMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1279,6 +1271,59 @@ func (m historyStormdrainMods) RandomZone2NotNull(f *faker.Faker) HistoryStormdr }) } +// Set the model columns to this value +func (m historyStormdrainMods) Created(val null.Val[time.Time]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyStormdrainMods) CreatedFunc(f func() null.Val[time.Time]) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyStormdrainMods) UnsetCreated() HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyStormdrainMods) RandomCreated(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyStormdrainMods) RandomCreatedNotNull(f *faker.Faker) HistoryStormdrainMod { + return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyStormdrainMods) CreatedDate(val null.Val[int64]) HistoryStormdrainMod { return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { diff --git a/factory/history_timecard.bob.go b/factory/history_timecard.bob.go index b7ca2cf3..a9409459 100644 --- a/factory/history_timecard.bob.go +++ b/factory/history_timecard.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryTimecardModSlice) Apply(ctx context.Context, n *HistoryTimecar // HistoryTimecardTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryTimecardTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Activity func() null.Val[string] Comments func() null.Val[string] Creationdate func() null.Val[int64] @@ -60,6 +61,7 @@ type HistoryTimecardTemplate struct { Traplocid func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -96,7 +98,7 @@ func (t HistoryTimecardTemplate) setModelRels(o *models.HistoryTimecard) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryTimecards = append(rel.R.HistoryTimecards, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -108,7 +110,7 @@ func (o HistoryTimecardTemplate) BuildSetter() *models.HistoryTimecardSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Activity != nil { val := o.Activity() @@ -202,6 +204,10 @@ func (o HistoryTimecardTemplate) BuildSetter() *models.HistoryTimecardSetter { val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -328,6 +334,9 @@ func (o HistoryTimecardTemplate) Build() *models.HistoryTimecard { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -372,6 +381,10 @@ func (o HistoryTimecardTemplate) BuildMany(number int) models.HistoryTimecardSli } func ensureCreatableHistoryTimecard(m *models.HistoryTimecardSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -388,25 +401,6 @@ func ensureCreatableHistoryTimecard(m *models.HistoryTimecardSetter) { func (o *HistoryTimecardTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTimecard) error { var err error - isOrganizationDone, _ := historyTimecardRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyTimecardRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -417,11 +411,30 @@ func (o *HistoryTimecardTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableHistoryTimecard(opt) + if o.r.Organization == nil { + HistoryTimecardMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryTimecards.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -523,6 +536,7 @@ func (m historyTimecardMods) RandomizeAllColumns(f *faker.Faker) HistoryTimecard HistoryTimecardMods.RandomTraplocid(f), HistoryTimecardMods.RandomZone(f), HistoryTimecardMods.RandomZone2(f), + HistoryTimecardMods.RandomCreated(f), HistoryTimecardMods.RandomCreatedDate(f), HistoryTimecardMods.RandomCreatedUser(f), HistoryTimecardMods.RandomGeometryX(f), @@ -535,14 +549,14 @@ func (m historyTimecardMods) RandomizeAllColumns(f *faker.Faker) HistoryTimecard } // Set the model columns to this value -func (m historyTimecardMods) OrganizationID(val null.Val[int32]) HistoryTimecardMod { +func (m historyTimecardMods) OrganizationID(val int32) HistoryTimecardMod { return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyTimecardMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTimecardMod { +func (m historyTimecardMods) OrganizationIDFunc(f func() int32) HistoryTimecardMod { return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { o.OrganizationID = f }) @@ -557,32 +571,10 @@ func (m historyTimecardMods) UnsetOrganizationID() HistoryTimecardMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyTimecardMods) RandomOrganizationID(f *faker.Faker) HistoryTimecardMod { return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyTimecardMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1784,6 +1776,59 @@ func (m historyTimecardMods) RandomZone2NotNull(f *faker.Faker) HistoryTimecardM }) } +// Set the model columns to this value +func (m historyTimecardMods) Created(val null.Val[time.Time]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyTimecardMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyTimecardMods) UnsetCreated() HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyTimecardMods) RandomCreated(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyTimecardMods) RandomCreatedNotNull(f *faker.Faker) HistoryTimecardMod { + return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyTimecardMods) CreatedDate(val null.Val[int64]) HistoryTimecardMod { return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { diff --git a/factory/history_trapdata.bob.go b/factory/history_trapdata.bob.go index 5cad6b81..5f8456f2 100644 --- a/factory/history_trapdata.bob.go +++ b/factory/history_trapdata.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryTrapdatumModSlice) Apply(ctx context.Context, n *HistoryTrapda // HistoryTrapdatumTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryTrapdatumTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Avetemp func() null.Val[float64] Comments func() null.Val[string] Creationdate func() null.Val[int64] @@ -72,6 +73,7 @@ type HistoryTrapdatumTemplate struct { Windspeed func() null.Val[float64] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -110,7 +112,7 @@ func (t HistoryTrapdatumTemplate) setModelRels(o *models.HistoryTrapdatum) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryTrapdata = append(rel.R.HistoryTrapdata, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -122,7 +124,7 @@ func (o HistoryTrapdatumTemplate) BuildSetter() *models.HistoryTrapdatumSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Avetemp != nil { val := o.Avetemp() @@ -264,6 +266,10 @@ func (o HistoryTrapdatumTemplate) BuildSetter() *models.HistoryTrapdatumSetter { val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -434,6 +440,9 @@ func (o HistoryTrapdatumTemplate) Build() *models.HistoryTrapdatum { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -484,6 +493,10 @@ func (o HistoryTrapdatumTemplate) BuildMany(number int) models.HistoryTrapdatumS } func ensureCreatableHistoryTrapdatum(m *models.HistoryTrapdatumSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -500,25 +513,6 @@ func ensureCreatableHistoryTrapdatum(m *models.HistoryTrapdatumSetter) { func (o *HistoryTrapdatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTrapdatum) error { var err error - isOrganizationDone, _ := historyTrapdatumRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyTrapdatumRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -529,11 +523,30 @@ func (o *HistoryTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor opt := o.BuildSetter() ensureCreatableHistoryTrapdatum(opt) + if o.r.Organization == nil { + HistoryTrapdatumMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryTrapdata.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -647,6 +660,7 @@ func (m historyTrapdatumMods) RandomizeAllColumns(f *faker.Faker) HistoryTrapdat HistoryTrapdatumMods.RandomWindspeed(f), HistoryTrapdatumMods.RandomZone(f), HistoryTrapdatumMods.RandomZone2(f), + HistoryTrapdatumMods.RandomCreated(f), HistoryTrapdatumMods.RandomCreatedDate(f), HistoryTrapdatumMods.RandomCreatedUser(f), HistoryTrapdatumMods.RandomGeometryX(f), @@ -661,14 +675,14 @@ func (m historyTrapdatumMods) RandomizeAllColumns(f *faker.Faker) HistoryTrapdat } // Set the model columns to this value -func (m historyTrapdatumMods) OrganizationID(val null.Val[int32]) HistoryTrapdatumMod { +func (m historyTrapdatumMods) OrganizationID(val int32) HistoryTrapdatumMod { return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyTrapdatumMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTrapdatumMod { +func (m historyTrapdatumMods) OrganizationIDFunc(f func() int32) HistoryTrapdatumMod { return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { o.OrganizationID = f }) @@ -683,32 +697,10 @@ func (m historyTrapdatumMods) UnsetOrganizationID() HistoryTrapdatumMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyTrapdatumMods) RandomOrganizationID(f *faker.Faker) HistoryTrapdatumMod { return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyTrapdatumMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -2546,6 +2538,59 @@ func (m historyTrapdatumMods) RandomZone2NotNull(f *faker.Faker) HistoryTrapdatu }) } +// Set the model columns to this value +func (m historyTrapdatumMods) Created(val null.Val[time.Time]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyTrapdatumMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyTrapdatumMods) UnsetCreated() HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyTrapdatumMods) RandomCreated(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyTrapdatumMods) RandomCreatedNotNull(f *faker.Faker) HistoryTrapdatumMod { + return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyTrapdatumMods) CreatedDate(val null.Val[int64]) HistoryTrapdatumMod { return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { diff --git a/factory/history_traplocation.bob.go b/factory/history_traplocation.bob.go index 2bc2c67c..e26c8cda 100644 --- a/factory/history_traplocation.bob.go +++ b/factory/history_traplocation.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryTraplocationModSlice) Apply(ctx context.Context, n *HistoryTra // HistoryTraplocationTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryTraplocationTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Accessdesc func() null.Val[string] Active func() null.Val[int16] Comments func() null.Val[string] @@ -57,6 +58,7 @@ type HistoryTraplocationTemplate struct { Usetype func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -98,7 +100,7 @@ func (t HistoryTraplocationTemplate) setModelRels(o *models.HistoryTraplocation) if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryTraplocations = append(rel.R.HistoryTraplocations, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -110,7 +112,7 @@ func (o HistoryTraplocationTemplate) BuildSetter() *models.HistoryTraplocationSe if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Accessdesc != nil { val := o.Accessdesc() @@ -192,6 +194,10 @@ func (o HistoryTraplocationTemplate) BuildSetter() *models.HistoryTraplocationSe val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -329,6 +335,9 @@ func (o HistoryTraplocationTemplate) Build() *models.HistoryTraplocation { if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -388,6 +397,10 @@ func (o HistoryTraplocationTemplate) BuildMany(number int) models.HistoryTraploc } func ensureCreatableHistoryTraplocation(m *models.HistoryTraplocationSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -404,25 +417,6 @@ func ensureCreatableHistoryTraplocation(m *models.HistoryTraplocationSetter) { func (o *HistoryTraplocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTraplocation) error { var err error - isOrganizationDone, _ := historyTraplocationRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyTraplocationRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -433,11 +427,30 @@ func (o *HistoryTraplocationTemplate) Create(ctx context.Context, exec bob.Execu opt := o.BuildSetter() ensureCreatableHistoryTraplocation(opt) + if o.r.Organization == nil { + HistoryTraplocationMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryTraplocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -536,6 +549,7 @@ func (m historyTraplocationMods) RandomizeAllColumns(f *faker.Faker) HistoryTrap HistoryTraplocationMods.RandomUsetype(f), HistoryTraplocationMods.RandomZone(f), HistoryTraplocationMods.RandomZone2(f), + HistoryTraplocationMods.RandomCreated(f), HistoryTraplocationMods.RandomCreatedDate(f), HistoryTraplocationMods.RandomCreatedUser(f), HistoryTraplocationMods.RandomGeometryX(f), @@ -553,14 +567,14 @@ func (m historyTraplocationMods) RandomizeAllColumns(f *faker.Faker) HistoryTrap } // Set the model columns to this value -func (m historyTraplocationMods) OrganizationID(val null.Val[int32]) HistoryTraplocationMod { +func (m historyTraplocationMods) OrganizationID(val int32) HistoryTraplocationMod { return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyTraplocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTraplocationMod { +func (m historyTraplocationMods) OrganizationIDFunc(f func() int32) HistoryTraplocationMod { return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { o.OrganizationID = f }) @@ -575,32 +589,10 @@ func (m historyTraplocationMods) UnsetOrganizationID() HistoryTraplocationMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyTraplocationMods) RandomOrganizationID(f *faker.Faker) HistoryTraplocationMod { return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyTraplocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1643,6 +1635,59 @@ func (m historyTraplocationMods) RandomZone2NotNull(f *faker.Faker) HistoryTrapl }) } +// Set the model columns to this value +func (m historyTraplocationMods) Created(val null.Val[time.Time]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyTraplocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyTraplocationMods) UnsetCreated() HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyTraplocationMods) RandomCreated(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyTraplocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryTraplocationMod { + return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyTraplocationMods) CreatedDate(val null.Val[int64]) HistoryTraplocationMod { return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { diff --git a/factory/history_treatment.bob.go b/factory/history_treatment.bob.go index 70514a65..7a3ed505 100644 --- a/factory/history_treatment.bob.go +++ b/factory/history_treatment.bob.go @@ -36,7 +36,7 @@ func (mods HistoryTreatmentModSlice) Apply(ctx context.Context, n *HistoryTreatm // HistoryTreatmentTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryTreatmentTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Activity func() null.Val[string] Areaunit func() null.Val[string] Avetemp func() null.Val[float64] @@ -122,7 +122,7 @@ func (t HistoryTreatmentTemplate) setModelRels(o *models.HistoryTreatment) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryTreatments = append(rel.R.HistoryTreatments, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -134,7 +134,7 @@ func (o HistoryTreatmentTemplate) BuildSetter() *models.HistoryTreatmentSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Activity != nil { val := o.Activity() @@ -580,6 +580,10 @@ func (o HistoryTreatmentTemplate) BuildMany(number int) models.HistoryTreatmentS } func ensureCreatableHistoryTreatment(m *models.HistoryTreatmentSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -596,25 +600,6 @@ func ensureCreatableHistoryTreatment(m *models.HistoryTreatmentSetter) { func (o *HistoryTreatmentTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTreatment) error { var err error - isOrganizationDone, _ := historyTreatmentRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyTreatmentRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -625,11 +610,30 @@ func (o *HistoryTreatmentTemplate) Create(ctx context.Context, exec bob.Executor opt := o.BuildSetter() ensureCreatableHistoryTreatment(opt) + if o.r.Organization == nil { + HistoryTreatmentMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryTreatments.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -769,14 +773,14 @@ func (m historyTreatmentMods) RandomizeAllColumns(f *faker.Faker) HistoryTreatme } // Set the model columns to this value -func (m historyTreatmentMods) OrganizationID(val null.Val[int32]) HistoryTreatmentMod { +func (m historyTreatmentMods) OrganizationID(val int32) HistoryTreatmentMod { return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyTreatmentMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTreatmentMod { +func (m historyTreatmentMods) OrganizationIDFunc(f func() int32) HistoryTreatmentMod { return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { o.OrganizationID = f }) @@ -791,32 +795,10 @@ func (m historyTreatmentMods) UnsetOrganizationID() HistoryTreatmentMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyTreatmentMods) RandomOrganizationID(f *faker.Faker) HistoryTreatmentMod { return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyTreatmentMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } diff --git a/factory/history_treatmentarea.bob.go b/factory/history_treatmentarea.bob.go index e694b09e..0039da17 100644 --- a/factory/history_treatmentarea.bob.go +++ b/factory/history_treatmentarea.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryTreatmentareaModSlice) Apply(ctx context.Context, n *HistoryTr // HistoryTreatmentareaTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryTreatmentareaTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Comments func() null.Val[string] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -51,6 +52,7 @@ type HistoryTreatmentareaTemplate struct { Treatdate func() null.Val[int64] TreatID func() null.Val[string] Type func() null.Val[string] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -86,7 +88,7 @@ func (t HistoryTreatmentareaTemplate) setModelRels(o *models.HistoryTreatmentare if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryTreatmentareas = append(rel.R.HistoryTreatmentareas, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -98,7 +100,7 @@ func (o HistoryTreatmentareaTemplate) BuildSetter() *models.HistoryTreatmentarea if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Comments != nil { val := o.Comments() @@ -156,6 +158,10 @@ func (o HistoryTreatmentareaTemplate) BuildSetter() *models.HistoryTreatmentarea val := o.Type() m.Type = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -251,6 +257,9 @@ func (o HistoryTreatmentareaTemplate) Build() *models.HistoryTreatmentarea { if o.Type != nil { m.Type = o.Type() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -292,6 +301,10 @@ func (o HistoryTreatmentareaTemplate) BuildMany(number int) models.HistoryTreatm } func ensureCreatableHistoryTreatmentarea(m *models.HistoryTreatmentareaSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -308,25 +321,6 @@ func ensureCreatableHistoryTreatmentarea(m *models.HistoryTreatmentareaSetter) { func (o *HistoryTreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTreatmentarea) error { var err error - isOrganizationDone, _ := historyTreatmentareaRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyTreatmentareaRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -337,11 +331,30 @@ func (o *HistoryTreatmentareaTemplate) Create(ctx context.Context, exec bob.Exec opt := o.BuildSetter() ensureCreatableHistoryTreatmentarea(opt) + if o.r.Organization == nil { + HistoryTreatmentareaMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryTreatmentareas.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -434,6 +447,7 @@ func (m historyTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) HistoryTre HistoryTreatmentareaMods.RandomTreatdate(f), HistoryTreatmentareaMods.RandomTreatID(f), HistoryTreatmentareaMods.RandomType(f), + HistoryTreatmentareaMods.RandomCreated(f), HistoryTreatmentareaMods.RandomCreatedDate(f), HistoryTreatmentareaMods.RandomCreatedUser(f), HistoryTreatmentareaMods.RandomGeometryX(f), @@ -445,14 +459,14 @@ func (m historyTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) HistoryTre } // Set the model columns to this value -func (m historyTreatmentareaMods) OrganizationID(val null.Val[int32]) HistoryTreatmentareaMod { +func (m historyTreatmentareaMods) OrganizationID(val int32) HistoryTreatmentareaMod { return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyTreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryTreatmentareaMod { +func (m historyTreatmentareaMods) OrganizationIDFunc(f func() int32) HistoryTreatmentareaMod { return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { o.OrganizationID = f }) @@ -467,32 +481,10 @@ func (m historyTreatmentareaMods) UnsetOrganizationID() HistoryTreatmentareaMod // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyTreatmentareaMods) RandomOrganizationID(f *faker.Faker) HistoryTreatmentareaMod { return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyTreatmentareaMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -1217,6 +1209,59 @@ func (m historyTreatmentareaMods) RandomTypeNotNull(f *faker.Faker) HistoryTreat }) } +// Set the model columns to this value +func (m historyTreatmentareaMods) Created(val null.Val[time.Time]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyTreatmentareaMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyTreatmentareaMods) UnsetCreated() HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyTreatmentareaMods) RandomCreated(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyTreatmentareaMods) RandomCreatedNotNull(f *faker.Faker) HistoryTreatmentareaMod { + return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyTreatmentareaMods) CreatedDate(val null.Val[int64]) HistoryTreatmentareaMod { return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { diff --git a/factory/history_zones.bob.go b/factory/history_zones.bob.go index 5db559ca..7e81b0d6 100644 --- a/factory/history_zones.bob.go +++ b/factory/history_zones.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryZoneModSlice) Apply(ctx context.Context, n *HistoryZoneTemplat // HistoryZoneTemplate is an object representing the database table. // all columns are optional and should be set by mods type HistoryZoneTemplate struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Active func() null.Val[int64] Creationdate func() null.Val[int64] Creator func() null.Val[string] @@ -47,6 +48,7 @@ type HistoryZoneTemplate struct { Objectid func() int32 ShapeArea func() null.Val[float64] ShapeLength func() null.Val[float64] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -82,7 +84,7 @@ func (t HistoryZoneTemplate) setModelRels(o *models.HistoryZone) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryZones = append(rel.R.HistoryZones, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -94,7 +96,7 @@ func (o HistoryZoneTemplate) BuildSetter() *models.HistoryZoneSetter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Active != nil { val := o.Active() @@ -136,6 +138,10 @@ func (o HistoryZoneTemplate) BuildSetter() *models.HistoryZoneSetter { val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -219,6 +225,9 @@ func (o HistoryZoneTemplate) Build() *models.HistoryZone { if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -260,6 +269,10 @@ func (o HistoryZoneTemplate) BuildMany(number int) models.HistoryZoneSlice { } func ensureCreatableHistoryZone(m *models.HistoryZoneSetter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -276,25 +289,6 @@ func ensureCreatableHistoryZone(m *models.HistoryZoneSetter) { func (o *HistoryZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryZone) error { var err error - isOrganizationDone, _ := historyZoneRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyZoneRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -305,11 +299,30 @@ func (o *HistoryZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*m opt := o.BuildSetter() ensureCreatableHistoryZone(opt) + if o.r.Organization == nil { + HistoryZoneMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryZones.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -398,6 +411,7 @@ func (m historyZoneMods) RandomizeAllColumns(f *faker.Faker) HistoryZoneMod { HistoryZoneMods.RandomObjectid(f), HistoryZoneMods.RandomShapeArea(f), HistoryZoneMods.RandomShapeLength(f), + HistoryZoneMods.RandomCreated(f), HistoryZoneMods.RandomCreatedDate(f), HistoryZoneMods.RandomCreatedUser(f), HistoryZoneMods.RandomGeometryX(f), @@ -409,14 +423,14 @@ func (m historyZoneMods) RandomizeAllColumns(f *faker.Faker) HistoryZoneMod { } // Set the model columns to this value -func (m historyZoneMods) OrganizationID(val null.Val[int32]) HistoryZoneMod { +func (m historyZoneMods) OrganizationID(val int32) HistoryZoneMod { return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyZoneMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryZoneMod { +func (m historyZoneMods) OrganizationIDFunc(f func() int32) HistoryZoneMod { return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { o.OrganizationID = f }) @@ -431,32 +445,10 @@ func (m historyZoneMods) UnsetOrganizationID() HistoryZoneMod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyZoneMods) RandomOrganizationID(f *faker.Faker) HistoryZoneMod { return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyZoneMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -969,6 +961,59 @@ func (m historyZoneMods) RandomShapeLengthNotNull(f *faker.Faker) HistoryZoneMod }) } +// Set the model columns to this value +func (m historyZoneMods) Created(val null.Val[time.Time]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyZoneMods) CreatedFunc(f func() null.Val[time.Time]) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyZoneMods) UnsetCreated() HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyZoneMods) RandomCreated(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyZoneMods) RandomCreatedNotNull(f *faker.Faker) HistoryZoneMod { + return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyZoneMods) CreatedDate(val null.Val[int64]) HistoryZoneMod { return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { diff --git a/factory/history_zones2.bob.go b/factory/history_zones2.bob.go index 20edabe3..c38fca26 100644 --- a/factory/history_zones2.bob.go +++ b/factory/history_zones2.bob.go @@ -6,6 +6,7 @@ package factory import ( "context" "testing" + "time" models "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" @@ -36,7 +37,7 @@ func (mods HistoryZones2ModSlice) Apply(ctx context.Context, n *HistoryZones2Tem // HistoryZones2Template is an object representing the database table. // all columns are optional and should be set by mods type HistoryZones2Template struct { - OrganizationID func() null.Val[int32] + OrganizationID func() int32 Creationdate func() null.Val[int64] Creator func() null.Val[string] Editdate func() null.Val[int64] @@ -46,6 +47,7 @@ type HistoryZones2Template struct { Objectid func() int32 ShapeArea func() null.Val[float64] ShapeLength func() null.Val[float64] + Created func() null.Val[time.Time] CreatedDate func() null.Val[int64] CreatedUser func() null.Val[string] GeometryX func() null.Val[float64] @@ -81,7 +83,7 @@ func (t HistoryZones2Template) setModelRels(o *models.HistoryZones2) { if t.r.Organization != nil { rel := t.r.Organization.o.Build() rel.R.HistoryZones2s = append(rel.R.HistoryZones2s, o) - o.OrganizationID = null.From(rel.ID) // h2 + o.OrganizationID = rel.ID // h2 o.R.Organization = rel } } @@ -93,7 +95,7 @@ func (o HistoryZones2Template) BuildSetter() *models.HistoryZones2Setter { if o.OrganizationID != nil { val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) + m.OrganizationID = omit.From(val) } if o.Creationdate != nil { val := o.Creationdate() @@ -131,6 +133,10 @@ func (o HistoryZones2Template) BuildSetter() *models.HistoryZones2Setter { val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Created != nil { + val := o.Created() + m.Created = omitnull.FromNull(val) + } if o.CreatedDate != nil { val := o.CreatedDate() m.CreatedDate = omitnull.FromNull(val) @@ -211,6 +217,9 @@ func (o HistoryZones2Template) Build() *models.HistoryZones2 { if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Created != nil { + m.Created = o.Created() + } if o.CreatedDate != nil { m.CreatedDate = o.CreatedDate() } @@ -252,6 +261,10 @@ func (o HistoryZones2Template) BuildMany(number int) models.HistoryZones2Slice { } func ensureCreatableHistoryZones2(m *models.HistoryZones2Setter) { + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } if !(m.Objectid.IsValue()) { val := random_int32(nil) m.Objectid = omit.From(val) @@ -268,25 +281,6 @@ func ensureCreatableHistoryZones2(m *models.HistoryZones2Setter) { func (o *HistoryZones2Template) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryZones2) error { var err error - isOrganizationDone, _ := historyZones2RelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = historyZones2RelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - return err } @@ -297,11 +291,30 @@ func (o *HistoryZones2Template) Create(ctx context.Context, exec bob.Executor) ( opt := o.BuildSetter() ensureCreatableHistoryZones2(opt) + if o.r.Organization == nil { + HistoryZones2Mods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.HistoryZones2s.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -389,6 +402,7 @@ func (m historyZones2Mods) RandomizeAllColumns(f *faker.Faker) HistoryZones2Mod HistoryZones2Mods.RandomObjectid(f), HistoryZones2Mods.RandomShapeArea(f), HistoryZones2Mods.RandomShapeLength(f), + HistoryZones2Mods.RandomCreated(f), HistoryZones2Mods.RandomCreatedDate(f), HistoryZones2Mods.RandomCreatedUser(f), HistoryZones2Mods.RandomGeometryX(f), @@ -400,14 +414,14 @@ func (m historyZones2Mods) RandomizeAllColumns(f *faker.Faker) HistoryZones2Mod } // Set the model columns to this value -func (m historyZones2Mods) OrganizationID(val null.Val[int32]) HistoryZones2Mod { +func (m historyZones2Mods) OrganizationID(val int32) HistoryZones2Mod { return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.OrganizationID = func() null.Val[int32] { return val } + o.OrganizationID = func() int32 { return val } }) } // Set the Column from the function -func (m historyZones2Mods) OrganizationIDFunc(f func() null.Val[int32]) HistoryZones2Mod { +func (m historyZones2Mods) OrganizationIDFunc(f func() int32) HistoryZones2Mod { return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { o.OrganizationID = f }) @@ -422,32 +436,10 @@ func (m historyZones2Mods) UnsetOrganizationID() HistoryZones2Mod { // Generates a random value for the column using the given faker // if faker is nil, a default faker is used -// The generated value is sometimes null func (m historyZones2Mods) RandomOrganizationID(f *faker.Faker) HistoryZones2Mod { return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m historyZones2Mods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) + o.OrganizationID = func() int32 { + return random_int32(f) } }) } @@ -907,6 +899,59 @@ func (m historyZones2Mods) RandomShapeLengthNotNull(f *faker.Faker) HistoryZones }) } +// Set the model columns to this value +func (m historyZones2Mods) Created(val null.Val[time.Time]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Created = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m historyZones2Mods) CreatedFunc(f func() null.Val[time.Time]) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Created = f + }) +} + +// Clear any values for the column +func (m historyZones2Mods) UnsetCreated() HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m historyZones2Mods) RandomCreated(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m historyZones2Mods) RandomCreatedNotNull(f *faker.Faker) HistoryZones2Mod { + return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { + o.Created = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + // Set the model columns to this value func (m historyZones2Mods) CreatedDate(val null.Val[int64]) HistoryZones2Mod { return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { diff --git a/factory/organization.bob.go b/factory/organization.bob.go index d64dc35c..fcd40657 100644 --- a/factory/organization.bob.go +++ b/factory/organization.bob.go @@ -49,6 +49,7 @@ type OrganizationTemplate struct { } type organizationR struct { + FieldseekerSyncs []*organizationRFieldseekerSyncsR FSContainerrelates []*organizationRFSContainerrelatesR FSFieldscoutinglogs []*organizationRFSFieldscoutinglogsR FSHabitatrelates []*organizationRFSHabitatrelatesR @@ -106,6 +107,10 @@ type organizationR struct { User []*organizationRUserR } +type organizationRFieldseekerSyncsR struct { + number int + o *FieldseekerSyncTemplate +} type organizationRFSContainerrelatesR struct { number int o *FSContainerrelateTemplate @@ -337,12 +342,25 @@ func (o *OrganizationTemplate) Apply(ctx context.Context, mods ...OrganizationMo // setModelRels creates and sets the relationships on *models.Organization // according to the relationships in the template. Nothing is inserted into the db func (t OrganizationTemplate) setModelRels(o *models.Organization) { + if t.r.FieldseekerSyncs != nil { + rel := models.FieldseekerSyncSlice{} + for _, r := range t.r.FieldseekerSyncs { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.OrganizationID = o.ID // h2 + rel.R.Organization = o + } + rel = append(rel, related...) + } + o.R.FieldseekerSyncs = rel + } + if t.r.FSContainerrelates != nil { rel := models.FSContainerrelateSlice{} for _, r := range t.r.FSContainerrelates { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -355,7 +373,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSFieldscoutinglogs { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -368,7 +386,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSHabitatrelates { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -381,7 +399,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSInspectionsamples { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -394,7 +412,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSInspectionsampledetails { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -407,7 +425,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSLinelocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -420,7 +438,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSLocationtrackings { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -433,7 +451,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSMosquitoinspections { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -446,7 +464,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSPointlocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -459,7 +477,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSPolygonlocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -472,7 +490,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSPools { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -485,7 +503,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSPooldetails { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -498,7 +516,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSProposedtreatmentareas { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -511,7 +529,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSQamosquitoinspections { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -524,7 +542,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSRodentlocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -537,7 +555,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSSamplecollections { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -550,7 +568,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSSamplelocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -563,7 +581,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSServicerequests { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -576,7 +594,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSSpeciesabundances { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -589,7 +607,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSStormdrains { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -602,7 +620,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSTimecards { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -615,7 +633,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSTrapdata { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -628,7 +646,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSTraplocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -641,7 +659,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSTreatments { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -654,7 +672,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSTreatmentareas { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -667,7 +685,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSZones { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -680,7 +698,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.FSZones2s { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -693,7 +711,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryContainerrelates { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -706,7 +724,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryFieldscoutinglogs { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -719,7 +737,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryHabitatrelates { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -732,7 +750,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryInspectionsamples { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -745,7 +763,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryInspectionsampledetails { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -758,7 +776,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryLinelocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -771,7 +789,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryLocationtrackings { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -784,7 +802,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryMosquitoinspections { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -797,7 +815,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryPointlocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -810,7 +828,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryPolygonlocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -823,7 +841,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryPools { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -836,7 +854,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryPooldetails { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -849,7 +867,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryProposedtreatmentareas { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -862,7 +880,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryQamosquitoinspections { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -875,7 +893,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryRodentlocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -888,7 +906,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistorySamplecollections { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -901,7 +919,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistorySamplelocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -914,7 +932,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryServicerequests { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -927,7 +945,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistorySpeciesabundances { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -940,7 +958,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryStormdrains { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -953,7 +971,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryTimecards { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -966,7 +984,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryTrapdata { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -979,7 +997,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryTraplocations { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -992,7 +1010,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryTreatments { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -1005,7 +1023,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryTreatmentareas { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -1018,7 +1036,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryZones { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -1031,7 +1049,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { for _, r := range t.r.HistoryZones2s { related := r.o.BuildMany(r.number) for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 + rel.OrganizationID = o.ID // h2 rel.R.Organization = o } rel = append(rel, related...) @@ -1143,6 +1161,26 @@ func ensureCreatableOrganization(m *models.OrganizationSetter) { func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Organization) error { var err error + isFieldseekerSyncsDone, _ := organizationRelFieldseekerSyncsCtx.Value(ctx) + if !isFieldseekerSyncsDone && o.r.FieldseekerSyncs != nil { + ctx = organizationRelFieldseekerSyncsCtx.WithValue(ctx, true) + for _, r := range o.r.FieldseekerSyncs { + if r.o.alreadyPersisted { + m.R.FieldseekerSyncs = append(m.R.FieldseekerSyncs, r.o.Build()) + } else { + rel0, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFieldseekerSyncs(ctx, exec, rel0...) + if err != nil { + return err + } + } + } + } + isFSContainerrelatesDone, _ := organizationRelFSContainerrelatesCtx.Value(ctx) if !isFSContainerrelatesDone && o.r.FSContainerrelates != nil { ctx = organizationRelFSContainerrelatesCtx.WithValue(ctx, true) @@ -1150,12 +1188,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSContainerrelates = append(m.R.FSContainerrelates, r.o.Build()) } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) + rel1, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSContainerrelates(ctx, exec, rel0...) + err = m.AttachFSContainerrelates(ctx, exec, rel1...) if err != nil { return err } @@ -1170,12 +1208,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSFieldscoutinglogs = append(m.R.FSFieldscoutinglogs, r.o.Build()) } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) + rel2, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSFieldscoutinglogs(ctx, exec, rel1...) + err = m.AttachFSFieldscoutinglogs(ctx, exec, rel2...) if err != nil { return err } @@ -1190,12 +1228,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSHabitatrelates = append(m.R.FSHabitatrelates, r.o.Build()) } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) + rel3, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSHabitatrelates(ctx, exec, rel2...) + err = m.AttachFSHabitatrelates(ctx, exec, rel3...) if err != nil { return err } @@ -1210,12 +1248,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSInspectionsamples = append(m.R.FSInspectionsamples, r.o.Build()) } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) + rel4, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSInspectionsamples(ctx, exec, rel3...) + err = m.AttachFSInspectionsamples(ctx, exec, rel4...) if err != nil { return err } @@ -1230,12 +1268,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSInspectionsampledetails = append(m.R.FSInspectionsampledetails, r.o.Build()) } else { - rel4, err := r.o.CreateMany(ctx, exec, r.number) + rel5, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSInspectionsampledetails(ctx, exec, rel4...) + err = m.AttachFSInspectionsampledetails(ctx, exec, rel5...) if err != nil { return err } @@ -1250,12 +1288,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSLinelocations = append(m.R.FSLinelocations, r.o.Build()) } else { - rel5, err := r.o.CreateMany(ctx, exec, r.number) + rel6, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSLinelocations(ctx, exec, rel5...) + err = m.AttachFSLinelocations(ctx, exec, rel6...) if err != nil { return err } @@ -1270,12 +1308,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSLocationtrackings = append(m.R.FSLocationtrackings, r.o.Build()) } else { - rel6, err := r.o.CreateMany(ctx, exec, r.number) + rel7, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSLocationtrackings(ctx, exec, rel6...) + err = m.AttachFSLocationtrackings(ctx, exec, rel7...) if err != nil { return err } @@ -1290,12 +1328,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSMosquitoinspections = append(m.R.FSMosquitoinspections, r.o.Build()) } else { - rel7, err := r.o.CreateMany(ctx, exec, r.number) + rel8, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSMosquitoinspections(ctx, exec, rel7...) + err = m.AttachFSMosquitoinspections(ctx, exec, rel8...) if err != nil { return err } @@ -1310,12 +1348,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSPointlocations = append(m.R.FSPointlocations, r.o.Build()) } else { - rel8, err := r.o.CreateMany(ctx, exec, r.number) + rel9, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSPointlocations(ctx, exec, rel8...) + err = m.AttachFSPointlocations(ctx, exec, rel9...) if err != nil { return err } @@ -1330,12 +1368,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSPolygonlocations = append(m.R.FSPolygonlocations, r.o.Build()) } else { - rel9, err := r.o.CreateMany(ctx, exec, r.number) + rel10, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSPolygonlocations(ctx, exec, rel9...) + err = m.AttachFSPolygonlocations(ctx, exec, rel10...) if err != nil { return err } @@ -1350,12 +1388,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSPools = append(m.R.FSPools, r.o.Build()) } else { - rel10, err := r.o.CreateMany(ctx, exec, r.number) + rel11, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSPools(ctx, exec, rel10...) + err = m.AttachFSPools(ctx, exec, rel11...) if err != nil { return err } @@ -1370,12 +1408,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSPooldetails = append(m.R.FSPooldetails, r.o.Build()) } else { - rel11, err := r.o.CreateMany(ctx, exec, r.number) + rel12, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSPooldetails(ctx, exec, rel11...) + err = m.AttachFSPooldetails(ctx, exec, rel12...) if err != nil { return err } @@ -1390,12 +1428,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSProposedtreatmentareas = append(m.R.FSProposedtreatmentareas, r.o.Build()) } else { - rel12, err := r.o.CreateMany(ctx, exec, r.number) + rel13, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSProposedtreatmentareas(ctx, exec, rel12...) + err = m.AttachFSProposedtreatmentareas(ctx, exec, rel13...) if err != nil { return err } @@ -1410,12 +1448,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSQamosquitoinspections = append(m.R.FSQamosquitoinspections, r.o.Build()) } else { - rel13, err := r.o.CreateMany(ctx, exec, r.number) + rel14, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSQamosquitoinspections(ctx, exec, rel13...) + err = m.AttachFSQamosquitoinspections(ctx, exec, rel14...) if err != nil { return err } @@ -1430,12 +1468,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSRodentlocations = append(m.R.FSRodentlocations, r.o.Build()) } else { - rel14, err := r.o.CreateMany(ctx, exec, r.number) + rel15, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSRodentlocations(ctx, exec, rel14...) + err = m.AttachFSRodentlocations(ctx, exec, rel15...) if err != nil { return err } @@ -1450,12 +1488,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSSamplecollections = append(m.R.FSSamplecollections, r.o.Build()) } else { - rel15, err := r.o.CreateMany(ctx, exec, r.number) + rel16, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSSamplecollections(ctx, exec, rel15...) + err = m.AttachFSSamplecollections(ctx, exec, rel16...) if err != nil { return err } @@ -1470,12 +1508,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSSamplelocations = append(m.R.FSSamplelocations, r.o.Build()) } else { - rel16, err := r.o.CreateMany(ctx, exec, r.number) + rel17, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSSamplelocations(ctx, exec, rel16...) + err = m.AttachFSSamplelocations(ctx, exec, rel17...) if err != nil { return err } @@ -1490,12 +1528,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSServicerequests = append(m.R.FSServicerequests, r.o.Build()) } else { - rel17, err := r.o.CreateMany(ctx, exec, r.number) + rel18, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSServicerequests(ctx, exec, rel17...) + err = m.AttachFSServicerequests(ctx, exec, rel18...) if err != nil { return err } @@ -1510,12 +1548,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSSpeciesabundances = append(m.R.FSSpeciesabundances, r.o.Build()) } else { - rel18, err := r.o.CreateMany(ctx, exec, r.number) + rel19, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSSpeciesabundances(ctx, exec, rel18...) + err = m.AttachFSSpeciesabundances(ctx, exec, rel19...) if err != nil { return err } @@ -1530,12 +1568,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSStormdrains = append(m.R.FSStormdrains, r.o.Build()) } else { - rel19, err := r.o.CreateMany(ctx, exec, r.number) + rel20, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSStormdrains(ctx, exec, rel19...) + err = m.AttachFSStormdrains(ctx, exec, rel20...) if err != nil { return err } @@ -1550,12 +1588,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSTimecards = append(m.R.FSTimecards, r.o.Build()) } else { - rel20, err := r.o.CreateMany(ctx, exec, r.number) + rel21, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSTimecards(ctx, exec, rel20...) + err = m.AttachFSTimecards(ctx, exec, rel21...) if err != nil { return err } @@ -1570,12 +1608,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSTrapdata = append(m.R.FSTrapdata, r.o.Build()) } else { - rel21, err := r.o.CreateMany(ctx, exec, r.number) + rel22, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSTrapdata(ctx, exec, rel21...) + err = m.AttachFSTrapdata(ctx, exec, rel22...) if err != nil { return err } @@ -1590,12 +1628,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSTraplocations = append(m.R.FSTraplocations, r.o.Build()) } else { - rel22, err := r.o.CreateMany(ctx, exec, r.number) + rel23, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSTraplocations(ctx, exec, rel22...) + err = m.AttachFSTraplocations(ctx, exec, rel23...) if err != nil { return err } @@ -1610,12 +1648,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSTreatments = append(m.R.FSTreatments, r.o.Build()) } else { - rel23, err := r.o.CreateMany(ctx, exec, r.number) + rel24, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSTreatments(ctx, exec, rel23...) + err = m.AttachFSTreatments(ctx, exec, rel24...) if err != nil { return err } @@ -1630,12 +1668,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSTreatmentareas = append(m.R.FSTreatmentareas, r.o.Build()) } else { - rel24, err := r.o.CreateMany(ctx, exec, r.number) + rel25, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSTreatmentareas(ctx, exec, rel24...) + err = m.AttachFSTreatmentareas(ctx, exec, rel25...) if err != nil { return err } @@ -1650,12 +1688,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSZones = append(m.R.FSZones, r.o.Build()) } else { - rel25, err := r.o.CreateMany(ctx, exec, r.number) + rel26, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSZones(ctx, exec, rel25...) + err = m.AttachFSZones(ctx, exec, rel26...) if err != nil { return err } @@ -1670,12 +1708,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.FSZones2s = append(m.R.FSZones2s, r.o.Build()) } else { - rel26, err := r.o.CreateMany(ctx, exec, r.number) + rel27, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSZones2s(ctx, exec, rel26...) + err = m.AttachFSZones2s(ctx, exec, rel27...) if err != nil { return err } @@ -1690,12 +1728,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryContainerrelates = append(m.R.HistoryContainerrelates, r.o.Build()) } else { - rel27, err := r.o.CreateMany(ctx, exec, r.number) + rel28, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryContainerrelates(ctx, exec, rel27...) + err = m.AttachHistoryContainerrelates(ctx, exec, rel28...) if err != nil { return err } @@ -1710,12 +1748,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryFieldscoutinglogs = append(m.R.HistoryFieldscoutinglogs, r.o.Build()) } else { - rel28, err := r.o.CreateMany(ctx, exec, r.number) + rel29, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryFieldscoutinglogs(ctx, exec, rel28...) + err = m.AttachHistoryFieldscoutinglogs(ctx, exec, rel29...) if err != nil { return err } @@ -1730,12 +1768,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryHabitatrelates = append(m.R.HistoryHabitatrelates, r.o.Build()) } else { - rel29, err := r.o.CreateMany(ctx, exec, r.number) + rel30, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryHabitatrelates(ctx, exec, rel29...) + err = m.AttachHistoryHabitatrelates(ctx, exec, rel30...) if err != nil { return err } @@ -1750,12 +1788,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryInspectionsamples = append(m.R.HistoryInspectionsamples, r.o.Build()) } else { - rel30, err := r.o.CreateMany(ctx, exec, r.number) + rel31, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryInspectionsamples(ctx, exec, rel30...) + err = m.AttachHistoryInspectionsamples(ctx, exec, rel31...) if err != nil { return err } @@ -1770,12 +1808,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryInspectionsampledetails = append(m.R.HistoryInspectionsampledetails, r.o.Build()) } else { - rel31, err := r.o.CreateMany(ctx, exec, r.number) + rel32, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryInspectionsampledetails(ctx, exec, rel31...) + err = m.AttachHistoryInspectionsampledetails(ctx, exec, rel32...) if err != nil { return err } @@ -1790,12 +1828,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryLinelocations = append(m.R.HistoryLinelocations, r.o.Build()) } else { - rel32, err := r.o.CreateMany(ctx, exec, r.number) + rel33, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryLinelocations(ctx, exec, rel32...) + err = m.AttachHistoryLinelocations(ctx, exec, rel33...) if err != nil { return err } @@ -1810,12 +1848,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryLocationtrackings = append(m.R.HistoryLocationtrackings, r.o.Build()) } else { - rel33, err := r.o.CreateMany(ctx, exec, r.number) + rel34, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryLocationtrackings(ctx, exec, rel33...) + err = m.AttachHistoryLocationtrackings(ctx, exec, rel34...) if err != nil { return err } @@ -1830,12 +1868,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryMosquitoinspections = append(m.R.HistoryMosquitoinspections, r.o.Build()) } else { - rel34, err := r.o.CreateMany(ctx, exec, r.number) + rel35, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryMosquitoinspections(ctx, exec, rel34...) + err = m.AttachHistoryMosquitoinspections(ctx, exec, rel35...) if err != nil { return err } @@ -1850,12 +1888,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryPointlocations = append(m.R.HistoryPointlocations, r.o.Build()) } else { - rel35, err := r.o.CreateMany(ctx, exec, r.number) + rel36, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryPointlocations(ctx, exec, rel35...) + err = m.AttachHistoryPointlocations(ctx, exec, rel36...) if err != nil { return err } @@ -1870,12 +1908,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryPolygonlocations = append(m.R.HistoryPolygonlocations, r.o.Build()) } else { - rel36, err := r.o.CreateMany(ctx, exec, r.number) + rel37, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryPolygonlocations(ctx, exec, rel36...) + err = m.AttachHistoryPolygonlocations(ctx, exec, rel37...) if err != nil { return err } @@ -1890,12 +1928,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryPools = append(m.R.HistoryPools, r.o.Build()) } else { - rel37, err := r.o.CreateMany(ctx, exec, r.number) + rel38, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryPools(ctx, exec, rel37...) + err = m.AttachHistoryPools(ctx, exec, rel38...) if err != nil { return err } @@ -1910,12 +1948,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryPooldetails = append(m.R.HistoryPooldetails, r.o.Build()) } else { - rel38, err := r.o.CreateMany(ctx, exec, r.number) + rel39, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryPooldetails(ctx, exec, rel38...) + err = m.AttachHistoryPooldetails(ctx, exec, rel39...) if err != nil { return err } @@ -1930,12 +1968,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryProposedtreatmentareas = append(m.R.HistoryProposedtreatmentareas, r.o.Build()) } else { - rel39, err := r.o.CreateMany(ctx, exec, r.number) + rel40, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryProposedtreatmentareas(ctx, exec, rel39...) + err = m.AttachHistoryProposedtreatmentareas(ctx, exec, rel40...) if err != nil { return err } @@ -1950,12 +1988,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryQamosquitoinspections = append(m.R.HistoryQamosquitoinspections, r.o.Build()) } else { - rel40, err := r.o.CreateMany(ctx, exec, r.number) + rel41, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryQamosquitoinspections(ctx, exec, rel40...) + err = m.AttachHistoryQamosquitoinspections(ctx, exec, rel41...) if err != nil { return err } @@ -1970,12 +2008,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryRodentlocations = append(m.R.HistoryRodentlocations, r.o.Build()) } else { - rel41, err := r.o.CreateMany(ctx, exec, r.number) + rel42, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryRodentlocations(ctx, exec, rel41...) + err = m.AttachHistoryRodentlocations(ctx, exec, rel42...) if err != nil { return err } @@ -1990,12 +2028,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistorySamplecollections = append(m.R.HistorySamplecollections, r.o.Build()) } else { - rel42, err := r.o.CreateMany(ctx, exec, r.number) + rel43, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistorySamplecollections(ctx, exec, rel42...) + err = m.AttachHistorySamplecollections(ctx, exec, rel43...) if err != nil { return err } @@ -2010,12 +2048,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistorySamplelocations = append(m.R.HistorySamplelocations, r.o.Build()) } else { - rel43, err := r.o.CreateMany(ctx, exec, r.number) + rel44, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistorySamplelocations(ctx, exec, rel43...) + err = m.AttachHistorySamplelocations(ctx, exec, rel44...) if err != nil { return err } @@ -2030,12 +2068,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryServicerequests = append(m.R.HistoryServicerequests, r.o.Build()) } else { - rel44, err := r.o.CreateMany(ctx, exec, r.number) + rel45, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryServicerequests(ctx, exec, rel44...) + err = m.AttachHistoryServicerequests(ctx, exec, rel45...) if err != nil { return err } @@ -2050,12 +2088,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistorySpeciesabundances = append(m.R.HistorySpeciesabundances, r.o.Build()) } else { - rel45, err := r.o.CreateMany(ctx, exec, r.number) + rel46, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistorySpeciesabundances(ctx, exec, rel45...) + err = m.AttachHistorySpeciesabundances(ctx, exec, rel46...) if err != nil { return err } @@ -2070,12 +2108,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryStormdrains = append(m.R.HistoryStormdrains, r.o.Build()) } else { - rel46, err := r.o.CreateMany(ctx, exec, r.number) + rel47, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryStormdrains(ctx, exec, rel46...) + err = m.AttachHistoryStormdrains(ctx, exec, rel47...) if err != nil { return err } @@ -2090,12 +2128,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryTimecards = append(m.R.HistoryTimecards, r.o.Build()) } else { - rel47, err := r.o.CreateMany(ctx, exec, r.number) + rel48, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryTimecards(ctx, exec, rel47...) + err = m.AttachHistoryTimecards(ctx, exec, rel48...) if err != nil { return err } @@ -2110,12 +2148,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryTrapdata = append(m.R.HistoryTrapdata, r.o.Build()) } else { - rel48, err := r.o.CreateMany(ctx, exec, r.number) + rel49, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryTrapdata(ctx, exec, rel48...) + err = m.AttachHistoryTrapdata(ctx, exec, rel49...) if err != nil { return err } @@ -2130,12 +2168,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryTraplocations = append(m.R.HistoryTraplocations, r.o.Build()) } else { - rel49, err := r.o.CreateMany(ctx, exec, r.number) + rel50, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryTraplocations(ctx, exec, rel49...) + err = m.AttachHistoryTraplocations(ctx, exec, rel50...) if err != nil { return err } @@ -2150,12 +2188,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryTreatments = append(m.R.HistoryTreatments, r.o.Build()) } else { - rel50, err := r.o.CreateMany(ctx, exec, r.number) + rel51, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryTreatments(ctx, exec, rel50...) + err = m.AttachHistoryTreatments(ctx, exec, rel51...) if err != nil { return err } @@ -2170,12 +2208,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryTreatmentareas = append(m.R.HistoryTreatmentareas, r.o.Build()) } else { - rel51, err := r.o.CreateMany(ctx, exec, r.number) + rel52, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryTreatmentareas(ctx, exec, rel51...) + err = m.AttachHistoryTreatmentareas(ctx, exec, rel52...) if err != nil { return err } @@ -2190,12 +2228,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryZones = append(m.R.HistoryZones, r.o.Build()) } else { - rel52, err := r.o.CreateMany(ctx, exec, r.number) + rel53, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryZones(ctx, exec, rel52...) + err = m.AttachHistoryZones(ctx, exec, rel53...) if err != nil { return err } @@ -2210,12 +2248,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.HistoryZones2s = append(m.R.HistoryZones2s, r.o.Build()) } else { - rel53, err := r.o.CreateMany(ctx, exec, r.number) + rel54, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryZones2s(ctx, exec, rel53...) + err = m.AttachHistoryZones2s(ctx, exec, rel54...) if err != nil { return err } @@ -2230,12 +2268,12 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu if r.o.alreadyPersisted { m.R.User = append(m.R.User, r.o.Build()) } else { - rel54, err := r.o.CreateMany(ctx, exec, r.number) + rel55, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachUser(ctx, exec, rel54...) + err = m.AttachUser(ctx, exec, rel55...) if err != nil { return err } @@ -2595,6 +2633,54 @@ func (m organizationMods) WithParentsCascading() OrganizationMod { }) } +func (m organizationMods) WithFieldseekerSyncs(number int, related *FieldseekerSyncTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FieldseekerSyncs = []*organizationRFieldseekerSyncsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFieldseekerSyncs(number int, mods ...FieldseekerSyncMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSyncWithContext(ctx, mods...) + m.WithFieldseekerSyncs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFieldseekerSyncs(number int, related *FieldseekerSyncTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FieldseekerSyncs = append(o.r.FieldseekerSyncs, &organizationRFieldseekerSyncsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFieldseekerSyncs(number int, mods ...FieldseekerSyncMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSyncWithContext(ctx, mods...) + m.AddFieldseekerSyncs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFieldseekerSyncs(existingModels ...*models.FieldseekerSync) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.FieldseekerSyncs = append(o.r.FieldseekerSyncs, &organizationRFieldseekerSyncsR{ + o: o.f.FromExistingFieldseekerSync(em), + }) + } + }) +} + +func (m organizationMods) WithoutFieldseekerSyncs() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.FieldseekerSyncs = nil + }) +} + func (m organizationMods) WithFSContainerrelates(number int, related *FSContainerrelateTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { o.r.FSContainerrelates = []*organizationRFSContainerrelatesR{{ diff --git a/migrations/00007_add_fieldseeker.sql b/migrations/00007_add_fieldseeker.sql index 5eca4a1d..b248cb8c 100644 --- a/migrations/00007_add_fieldseeker.sql +++ b/migrations/00007_add_fieldseeker.sql @@ -2,7 +2,7 @@ ALTER TABLE organization ADD COLUMN fieldseeker_url TEXT; CREATE TABLE fs_containerrelate ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), containertype text, creationdate bigint, creator text, @@ -24,7 +24,7 @@ CREATE TABLE fs_containerrelate ( CREATE TABLE fs_fieldscoutinglog ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -43,7 +43,7 @@ CREATE TABLE fs_fieldscoutinglog ( CREATE TABLE fs_habitatrelate ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -62,7 +62,7 @@ CREATE TABLE fs_habitatrelate ( ); CREATE TABLE fs_inspectionsample ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -83,7 +83,7 @@ CREATE TABLE fs_inspectionsample ( ); CREATE TABLE fs_inspectionsampledetail ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -115,7 +115,7 @@ CREATE TABLE fs_inspectionsampledetail ( ); CREATE TABLE fs_linelocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, acres double precision, active smallint, @@ -171,7 +171,7 @@ CREATE TABLE fs_linelocation ( CREATE TABLE fs_locationtracking ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accuracy double precision, creationdate bigint, creator text, @@ -191,7 +191,7 @@ CREATE TABLE fs_locationtracking ( CREATE TABLE fs_mosquitoinspection ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), actiontaken text, activity text, adultact text, @@ -256,7 +256,7 @@ CREATE TABLE fs_mosquitoinspection ( CREATE TABLE fs_pointlocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -308,7 +308,7 @@ CREATE TABLE fs_pointlocation ( CREATE TABLE fs_polygonlocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, acres double precision, active smallint, @@ -358,7 +358,7 @@ CREATE TABLE fs_polygonlocation ( CREATE TABLE fs_pool ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -393,7 +393,7 @@ CREATE TABLE fs_pool ( ); CREATE TABLE fs_pooldetail ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -414,7 +414,7 @@ CREATE TABLE fs_pooldetail ( ); CREATE TABLE fs_proposedtreatmentarea ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), acres double precision, comments text, completed smallint, @@ -454,7 +454,7 @@ CREATE TABLE fs_proposedtreatmentarea ( ); CREATE TABLE fs_qamosquitoinspection ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), acresbreeding double precision, actiontaken text, adultactivity smallint, @@ -523,7 +523,7 @@ CREATE TABLE fs_qamosquitoinspection ( ); CREATE TABLE fs_rodentlocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -560,7 +560,7 @@ CREATE TABLE fs_rodentlocation ( ); CREATE TABLE fs_samplecollection ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), activity text, avetemp double precision, chickenid text, @@ -613,7 +613,7 @@ CREATE TABLE fs_samplecollection ( ); CREATE TABLE fs_samplelocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -645,7 +645,7 @@ CREATE TABLE fs_samplelocation ( CREATE TABLE fs_servicerequest ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accepted smallint, acceptedby text, accepteddate bigint, @@ -739,7 +739,7 @@ CREATE TABLE fs_servicerequest ( CREATE TABLE fs_speciesabundance ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), bloodedfem smallint, creationdate bigint, creator text, @@ -776,7 +776,7 @@ CREATE TABLE fs_speciesabundance ( CREATE TABLE fs_stormdrain ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -803,7 +803,7 @@ CREATE TABLE fs_stormdrain ( CREATE TABLE fs_timecard ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), activity text, comments text, creationdate bigint, @@ -839,7 +839,7 @@ CREATE TABLE fs_timecard ( CREATE TABLE fs_trapdata ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), avetemp double precision, comments text, creationdate bigint, @@ -889,7 +889,7 @@ CREATE TABLE fs_trapdata ( CREATE TABLE fs_traplocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -927,7 +927,7 @@ CREATE TABLE fs_traplocation ( CREATE TABLE fs_treatment ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), activity text, areaunit text, avetemp double precision, @@ -989,7 +989,7 @@ CREATE TABLE fs_treatment ( CREATE TABLE fs_treatmentarea ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -1015,7 +1015,7 @@ CREATE TABLE fs_treatmentarea ( CREATE TABLE fs_zones ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), active bigint, creationdate bigint, creator text, @@ -1037,7 +1037,7 @@ CREATE TABLE fs_zones ( CREATE TABLE fs_zones2 ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -1057,7 +1057,7 @@ CREATE TABLE fs_zones2 ( ); CREATE TABLE history_containerrelate ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), containertype text, creationdate bigint, creator text, @@ -1081,7 +1081,7 @@ CREATE TABLE history_containerrelate ( CREATE TABLE history_fieldscoutinglog ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -1102,7 +1102,7 @@ CREATE TABLE history_fieldscoutinglog ( CREATE TABLE history_habitatrelate ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -1123,7 +1123,7 @@ CREATE TABLE history_habitatrelate ( ); CREATE TABLE history_inspectionsample ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -1146,7 +1146,7 @@ CREATE TABLE history_inspectionsample ( ); CREATE TABLE history_inspectionsampledetail ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -1180,7 +1180,7 @@ CREATE TABLE history_inspectionsampledetail ( ); CREATE TABLE history_linelocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, acres double precision, active smallint, @@ -1238,7 +1238,7 @@ CREATE TABLE history_linelocation ( CREATE TABLE history_locationtracking ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accuracy double precision, creationdate bigint, creator text, @@ -1260,7 +1260,7 @@ CREATE TABLE history_locationtracking ( CREATE TABLE history_mosquitoinspection ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), actiontaken text, activity text, adultact text, @@ -1327,10 +1327,11 @@ CREATE TABLE history_mosquitoinspection ( CREATE TABLE history_pointlocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, + created TIMESTAMP, creationdate bigint, creator text, description text, @@ -1380,7 +1381,7 @@ CREATE TABLE history_pointlocation ( CREATE TABLE history_polygonlocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, acres double precision, active smallint, @@ -1431,7 +1432,7 @@ CREATE TABLE history_polygonlocation ( CREATE TABLE history_pool ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -1468,7 +1469,7 @@ CREATE TABLE history_pool ( ); CREATE TABLE history_pooldetail ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -1491,7 +1492,7 @@ CREATE TABLE history_pooldetail ( ); CREATE TABLE history_proposedtreatmentarea ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), acres double precision, comments text, completed smallint, @@ -1532,7 +1533,7 @@ CREATE TABLE history_proposedtreatmentarea ( ); CREATE TABLE history_qamosquitoinspection ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), acresbreeding double precision, actiontaken text, adultactivity smallint, @@ -1603,7 +1604,7 @@ CREATE TABLE history_qamosquitoinspection ( ); CREATE TABLE history_rodentlocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -1642,7 +1643,7 @@ CREATE TABLE history_rodentlocation ( ); CREATE TABLE history_samplecollection ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), activity text, avetemp double precision, chickenid text, @@ -1697,7 +1698,7 @@ CREATE TABLE history_samplecollection ( ); CREATE TABLE history_samplelocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -1731,7 +1732,7 @@ CREATE TABLE history_samplelocation ( CREATE TABLE history_servicerequest ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accepted smallint, acceptedby text, accepteddate bigint, @@ -1827,7 +1828,7 @@ CREATE TABLE history_servicerequest ( CREATE TABLE history_speciesabundance ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), bloodedfem smallint, creationdate bigint, creator text, @@ -1866,7 +1867,7 @@ CREATE TABLE history_speciesabundance ( CREATE TABLE history_stormdrain ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, @@ -1895,7 +1896,7 @@ CREATE TABLE history_stormdrain ( CREATE TABLE history_timecard ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), activity text, comments text, creationdate bigint, @@ -1933,7 +1934,7 @@ CREATE TABLE history_timecard ( CREATE TABLE history_trapdata ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), avetemp double precision, comments text, creationdate bigint, @@ -1985,7 +1986,7 @@ CREATE TABLE history_trapdata ( CREATE TABLE history_traplocation ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), accessdesc text, active smallint, comments text, @@ -2025,7 +2026,7 @@ CREATE TABLE history_traplocation ( CREATE TABLE history_treatment ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), activity text, areaunit text, avetemp double precision, @@ -2088,7 +2089,7 @@ CREATE TABLE history_treatment ( CREATE TABLE history_treatmentarea ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), comments text, creationdate bigint, creator text, @@ -2116,7 +2117,7 @@ CREATE TABLE history_treatmentarea ( CREATE TABLE history_zones ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), active bigint, creationdate bigint, creator text, @@ -2140,7 +2141,7 @@ CREATE TABLE history_zones ( CREATE TABLE history_zones2 ( - organization_id INTEGER REFERENCES organization(id), + organization_id INTEGER NOT NULL REFERENCES organization(id), creationdate bigint, creator text, editdate bigint, diff --git a/migrations/00008_add_sync.sql b/migrations/00008_add_sync.sql new file mode 100644 index 00000000..e082efb4 --- /dev/null +++ b/migrations/00008_add_sync.sql @@ -0,0 +1,12 @@ +-- +goose Up +CREATE TABLE fieldseeker_sync ( + id SERIAL PRIMARY KEY, + created TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL, + records_created INTEGER NOT NULL, + records_updated INTEGER NOT NULL, + records_unchanged INTEGER NOT NULL, + organization_id INTEGER REFERENCES organization(id) NOT NULL +); + +-- +goose Down +DROP TABLE fieldseeker_sync; diff --git a/models/bob_joins.bob.go b/models/bob_joins.bob.go index 449bbf74..94bcb54d 100644 --- a/models/bob_joins.bob.go +++ b/models/bob_joins.bob.go @@ -32,6 +32,7 @@ func (j joinSet[Q]) AliasedAs(alias string) joinSet[Q] { } type joins[Q dialect.Joinable] struct { + FieldseekerSyncs joinSet[fieldseekerSyncJoins[Q]] FSContainerrelates joinSet[fsContainerrelateJoins[Q]] FSFieldscoutinglogs joinSet[fsFieldscoutinglogJoins[Q]] FSHabitatrelates joinSet[fsHabitatrelateJoins[Q]] @@ -101,6 +102,7 @@ func buildJoinSet[Q interface{ aliasedAs(string) Q }, C any, F func(C, string) Q func getJoins[Q dialect.Joinable]() joins[Q] { return joins[Q]{ + FieldseekerSyncs: buildJoinSet[fieldseekerSyncJoins[Q]](FieldseekerSyncs.Columns, buildFieldseekerSyncJoins), FSContainerrelates: buildJoinSet[fsContainerrelateJoins[Q]](FSContainerrelates.Columns, buildFSContainerrelateJoins), FSFieldscoutinglogs: buildJoinSet[fsFieldscoutinglogJoins[Q]](FSFieldscoutinglogs.Columns, buildFSFieldscoutinglogJoins), FSHabitatrelates: buildJoinSet[fsHabitatrelateJoins[Q]](FSHabitatrelates.Columns, buildFSHabitatrelateJoins), diff --git a/models/bob_loaders.bob.go b/models/bob_loaders.bob.go index 2888ff0c..4246fca1 100644 --- a/models/bob_loaders.bob.go +++ b/models/bob_loaders.bob.go @@ -17,6 +17,7 @@ import ( var Preload = getPreloaders() type preloaders struct { + FieldseekerSync fieldseekerSyncPreloader FSContainerrelate fsContainerrelatePreloader FSFieldscoutinglog fsFieldscoutinglogPreloader FSHabitatrelate fsHabitatrelatePreloader @@ -78,6 +79,7 @@ type preloaders struct { func getPreloaders() preloaders { return preloaders{ + FieldseekerSync: buildFieldseekerSyncPreloader(), FSContainerrelate: buildFSContainerrelatePreloader(), FSFieldscoutinglog: buildFSFieldscoutinglogPreloader(), FSHabitatrelate: buildFSHabitatrelatePreloader(), @@ -145,6 +147,7 @@ var ( ) type thenLoaders[Q orm.Loadable] struct { + FieldseekerSync fieldseekerSyncThenLoader[Q] FSContainerrelate fsContainerrelateThenLoader[Q] FSFieldscoutinglog fsFieldscoutinglogThenLoader[Q] FSHabitatrelate fsHabitatrelateThenLoader[Q] @@ -206,6 +209,7 @@ type thenLoaders[Q orm.Loadable] struct { func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { return thenLoaders[Q]{ + FieldseekerSync: buildFieldseekerSyncThenLoader[Q](), FSContainerrelate: buildFSContainerrelateThenLoader[Q](), FSFieldscoutinglog: buildFSFieldscoutinglogThenLoader[Q](), FSHabitatrelate: buildFSHabitatrelateThenLoader[Q](), diff --git a/models/bob_types.bob_test.go b/models/bob_types.bob_test.go index 731f53fd..98e19510 100644 --- a/models/bob_types.bob_test.go +++ b/models/bob_types.bob_test.go @@ -14,6 +14,9 @@ import ( // Set the testDB to enable tests that use the database var testDB bob.Transactor[bob.Tx] +// Make sure the type FieldseekerSync runs hooks after queries +var _ bob.HookableType = &FieldseekerSync{} + // Make sure the type FSContainerrelate runs hooks after queries var _ bob.HookableType = &FSContainerrelate{} diff --git a/models/bob_where.bob.go b/models/bob_where.bob.go index 68989581..11d30f97 100644 --- a/models/bob_where.bob.go +++ b/models/bob_where.bob.go @@ -17,6 +17,7 @@ var ( ) func Where[Q psql.Filterable]() struct { + FieldseekerSyncs fieldseekerSyncWhere[Q] FSContainerrelates fsContainerrelateWhere[Q] FSFieldscoutinglogs fsFieldscoutinglogWhere[Q] FSHabitatrelates fsHabitatrelateWhere[Q] @@ -78,6 +79,7 @@ func Where[Q psql.Filterable]() struct { Users userWhere[Q] } { return struct { + FieldseekerSyncs fieldseekerSyncWhere[Q] FSContainerrelates fsContainerrelateWhere[Q] FSFieldscoutinglogs fsFieldscoutinglogWhere[Q] FSHabitatrelates fsHabitatrelateWhere[Q] @@ -138,6 +140,7 @@ func Where[Q psql.Filterable]() struct { Sessions sessionWhere[Q] Users userWhere[Q] }{ + FieldseekerSyncs: buildFieldseekerSyncWhere[Q](FieldseekerSyncs.Columns), FSContainerrelates: buildFSContainerrelateWhere[Q](FSContainerrelates.Columns), FSFieldscoutinglogs: buildFSFieldscoutinglogWhere[Q](FSFieldscoutinglogs.Columns), FSHabitatrelates: buildFSHabitatrelateWhere[Q](FSHabitatrelates.Columns), diff --git a/models/fieldseeker_sync.bob.go b/models/fieldseeker_sync.bob.go new file mode 100644 index 00000000..216691fe --- /dev/null +++ b/models/fieldseeker_sync.bob.go @@ -0,0 +1,703 @@ +// Code generated by BobGen psql v0.41.1. 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/aarondl/opt/omit" + "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/dialect/psql" + "github.com/stephenafamo/bob/dialect/psql/dialect" + "github.com/stephenafamo/bob/dialect/psql/dm" + "github.com/stephenafamo/bob/dialect/psql/sm" + "github.com/stephenafamo/bob/dialect/psql/um" + "github.com/stephenafamo/bob/expr" + "github.com/stephenafamo/bob/mods" + "github.com/stephenafamo/bob/orm" + "github.com/stephenafamo/bob/types/pgtypes" +) + +// FieldseekerSync is an object representing the database table. +type FieldseekerSync struct { + ID int32 `db:"id,pk" ` + Created time.Time `db:"created" ` + RecordsCreated int32 `db:"records_created" ` + RecordsUpdated int32 `db:"records_updated" ` + RecordsUnchanged int32 `db:"records_unchanged" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerSyncR `db:"-" ` +} + +// FieldseekerSyncSlice is an alias for a slice of pointers to FieldseekerSync. +// This should almost always be used instead of []*FieldseekerSync. +type FieldseekerSyncSlice []*FieldseekerSync + +// FieldseekerSyncs contains methods to work with the fieldseeker_sync table +var FieldseekerSyncs = psql.NewTablex[*FieldseekerSync, FieldseekerSyncSlice, *FieldseekerSyncSetter]("", "fieldseeker_sync", buildFieldseekerSyncColumns("fieldseeker_sync")) + +// FieldseekerSyncsQuery is a query on the fieldseeker_sync table +type FieldseekerSyncsQuery = *psql.ViewQuery[*FieldseekerSync, FieldseekerSyncSlice] + +// fieldseekerSyncR is where relationships are stored. +type fieldseekerSyncR struct { + Organization *Organization // fieldseeker_sync.fieldseeker_sync_organization_id_fkey +} + +func buildFieldseekerSyncColumns(alias string) fieldseekerSyncColumns { + return fieldseekerSyncColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "id", "created", "records_created", "records_updated", "records_unchanged", "organization_id", + ).WithParent("fieldseeker_sync"), + tableAlias: alias, + ID: psql.Quote(alias, "id"), + Created: psql.Quote(alias, "created"), + RecordsCreated: psql.Quote(alias, "records_created"), + RecordsUpdated: psql.Quote(alias, "records_updated"), + RecordsUnchanged: psql.Quote(alias, "records_unchanged"), + OrganizationID: psql.Quote(alias, "organization_id"), + } +} + +type fieldseekerSyncColumns struct { + expr.ColumnsExpr + tableAlias string + ID psql.Expression + Created psql.Expression + RecordsCreated psql.Expression + RecordsUpdated psql.Expression + RecordsUnchanged psql.Expression + OrganizationID psql.Expression +} + +func (c fieldseekerSyncColumns) Alias() string { + return c.tableAlias +} + +func (fieldseekerSyncColumns) AliasedAs(alias string) fieldseekerSyncColumns { + return buildFieldseekerSyncColumns(alias) +} + +// FieldseekerSyncSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type FieldseekerSyncSetter struct { + ID omit.Val[int32] `db:"id,pk" ` + Created omit.Val[time.Time] `db:"created" ` + RecordsCreated omit.Val[int32] `db:"records_created" ` + RecordsUpdated omit.Val[int32] `db:"records_updated" ` + RecordsUnchanged omit.Val[int32] `db:"records_unchanged" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` +} + +func (s FieldseekerSyncSetter) SetColumns() []string { + vals := make([]string, 0, 6) + if s.ID.IsValue() { + vals = append(vals, "id") + } + if s.Created.IsValue() { + vals = append(vals, "created") + } + if s.RecordsCreated.IsValue() { + vals = append(vals, "records_created") + } + if s.RecordsUpdated.IsValue() { + vals = append(vals, "records_updated") + } + if s.RecordsUnchanged.IsValue() { + vals = append(vals, "records_unchanged") + } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } + return vals +} + +func (s FieldseekerSyncSetter) Overwrite(t *FieldseekerSync) { + if s.ID.IsValue() { + t.ID = s.ID.MustGet() + } + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.RecordsCreated.IsValue() { + t.RecordsCreated = s.RecordsCreated.MustGet() + } + if s.RecordsUpdated.IsValue() { + t.RecordsUpdated = s.RecordsUpdated.MustGet() + } + if s.RecordsUnchanged.IsValue() { + t.RecordsUnchanged = s.RecordsUnchanged.MustGet() + } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } +} + +func (s *FieldseekerSyncSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FieldseekerSyncs.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 6) + if s.ID.IsValue() { + vals[0] = psql.Arg(s.ID.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.Created.IsValue() { + vals[1] = psql.Arg(s.Created.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if s.RecordsCreated.IsValue() { + vals[2] = psql.Arg(s.RecordsCreated.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.RecordsUpdated.IsValue() { + vals[3] = psql.Arg(s.RecordsUpdated.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if s.RecordsUnchanged.IsValue() { + vals[4] = psql.Arg(s.RecordsUnchanged.MustGet()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[5] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FieldseekerSyncSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FieldseekerSyncSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 6) + + if s.ID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "id")...), + psql.Arg(s.ID), + }}) + } + + if s.Created.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + + if s.RecordsCreated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "records_created")...), + psql.Arg(s.RecordsCreated), + }}) + } + + if s.RecordsUpdated.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "records_updated")...), + psql.Arg(s.RecordsUpdated), + }}) + } + + if s.RecordsUnchanged.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "records_unchanged")...), + psql.Arg(s.RecordsUnchanged), + }}) + } + + if s.OrganizationID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + return exprs +} + +// FindFieldseekerSync retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFieldseekerSync(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*FieldseekerSync, error) { + if len(cols) == 0 { + return FieldseekerSyncs.Query( + sm.Where(FieldseekerSyncs.Columns.ID.EQ(psql.Arg(IDPK))), + ).One(ctx, exec) + } + + return FieldseekerSyncs.Query( + sm.Where(FieldseekerSyncs.Columns.ID.EQ(psql.Arg(IDPK))), + sm.Columns(FieldseekerSyncs.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FieldseekerSyncExists checks the presence of a single record by primary key +func FieldseekerSyncExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) { + return FieldseekerSyncs.Query( + sm.Where(FieldseekerSyncs.Columns.ID.EQ(psql.Arg(IDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FieldseekerSync is retrieved from the database +func (o *FieldseekerSync) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FieldseekerSyncs.AfterSelectHooks.RunHooks(ctx, exec, FieldseekerSyncSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FieldseekerSyncs.AfterInsertHooks.RunHooks(ctx, exec, FieldseekerSyncSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FieldseekerSyncs.AfterUpdateHooks.RunHooks(ctx, exec, FieldseekerSyncSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FieldseekerSyncs.AfterDeleteHooks.RunHooks(ctx, exec, FieldseekerSyncSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FieldseekerSync +func (o *FieldseekerSync) primaryKeyVals() bob.Expression { + return psql.Arg(o.ID) +} + +func (o *FieldseekerSync) pkEQ() dialect.Expression { + return psql.Quote("fieldseeker_sync", "id").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the FieldseekerSync +func (o *FieldseekerSync) Update(ctx context.Context, exec bob.Executor, s *FieldseekerSyncSetter) error { + v, err := FieldseekerSyncs.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 FieldseekerSync record with an executor +func (o *FieldseekerSync) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FieldseekerSyncs.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FieldseekerSync using the executor +func (o *FieldseekerSync) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FieldseekerSyncs.Query( + sm.Where(FieldseekerSyncs.Columns.ID.EQ(psql.Arg(o.ID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FieldseekerSyncSlice is retrieved from the database +func (o FieldseekerSyncSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FieldseekerSyncs.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FieldseekerSyncs.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FieldseekerSyncs.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FieldseekerSyncs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FieldseekerSyncSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("fieldseeker_sync", "id").In(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, 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 FieldseekerSyncSlice) copyMatchingRows(from ...*FieldseekerSync) { + for i, old := range o { + for _, new := range from { + if new.ID != old.ID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FieldseekerSyncSlice) 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 FieldseekerSyncs.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 *FieldseekerSync: + o.copyMatchingRows(retrieved) + case []*FieldseekerSync: + o.copyMatchingRows(retrieved...) + case FieldseekerSyncSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FieldseekerSync or a slice of FieldseekerSync + // then run the AfterUpdateHooks on the slice + _, err = FieldseekerSyncs.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FieldseekerSyncSlice) 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 FieldseekerSyncs.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 *FieldseekerSync: + o.copyMatchingRows(retrieved) + case []*FieldseekerSync: + o.copyMatchingRows(retrieved...) + case FieldseekerSyncSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FieldseekerSync or a slice of FieldseekerSync + // then run the AfterDeleteHooks on the slice + _, err = FieldseekerSyncs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FieldseekerSyncSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FieldseekerSyncSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FieldseekerSyncs.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FieldseekerSyncSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FieldseekerSyncs.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FieldseekerSyncSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FieldseekerSyncs.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// Organization starts a query for related objects on organization +func (o *FieldseekerSync) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerSyncSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkOrganizationID = append(pkOrganizationID, o.OrganizationID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkOrganizationID), "integer[]")), + )) + + return Organizations.Query(append(mods, + sm.Where(psql.Group(Organizations.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +func attachFieldseekerSyncOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerSync0 *FieldseekerSync, organization1 *Organization) (*FieldseekerSync, error) { + setter := &FieldseekerSyncSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerSync0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerSyncOrganization0: %w", err) + } + + return fieldseekerSync0, nil +} + +func (fieldseekerSync0 *FieldseekerSync) InsertOrganization(ctx context.Context, exec bob.Executor, related *OrganizationSetter) error { + var err error + + organization1, err := Organizations.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachFieldseekerSyncOrganization0(ctx, exec, 1, fieldseekerSync0, organization1) + if err != nil { + return err + } + + fieldseekerSync0.R.Organization = organization1 + + organization1.R.FieldseekerSyncs = append(organization1.R.FieldseekerSyncs, fieldseekerSync0) + + return nil +} + +func (fieldseekerSync0 *FieldseekerSync) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerSyncOrganization0(ctx, exec, 1, fieldseekerSync0, organization1) + if err != nil { + return err + } + + fieldseekerSync0.R.Organization = organization1 + + organization1.R.FieldseekerSyncs = append(organization1.R.FieldseekerSyncs, fieldseekerSync0) + + return nil +} + +type fieldseekerSyncWhere[Q psql.Filterable] struct { + ID psql.WhereMod[Q, int32] + Created psql.WhereMod[Q, time.Time] + RecordsCreated psql.WhereMod[Q, int32] + RecordsUpdated psql.WhereMod[Q, int32] + RecordsUnchanged psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] +} + +func (fieldseekerSyncWhere[Q]) AliasedAs(alias string) fieldseekerSyncWhere[Q] { + return buildFieldseekerSyncWhere[Q](buildFieldseekerSyncColumns(alias)) +} + +func buildFieldseekerSyncWhere[Q psql.Filterable](cols fieldseekerSyncColumns) fieldseekerSyncWhere[Q] { + return fieldseekerSyncWhere[Q]{ + ID: psql.Where[Q, int32](cols.ID), + Created: psql.Where[Q, time.Time](cols.Created), + RecordsCreated: psql.Where[Q, int32](cols.RecordsCreated), + RecordsUpdated: psql.Where[Q, int32](cols.RecordsUpdated), + RecordsUnchanged: psql.Where[Q, int32](cols.RecordsUnchanged), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerSync) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerSync cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.FieldseekerSyncs = FieldseekerSyncSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerSync has no relationship %q", name) + } +} + +type fieldseekerSyncPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerSyncPreloader() fieldseekerSyncPreloader { + return fieldseekerSyncPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerSyncs, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerSyncThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerSyncThenLoader[Q orm.Loadable]() fieldseekerSyncThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerSyncThenLoader[Q]{ + Organization: thenLoadBuilder[Q]( + "Organization", + func(ctx context.Context, exec bob.Executor, retrieved OrganizationLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadOrganization(ctx, exec, mods...) + }, + ), + } +} + +// LoadOrganization loads the fieldseekerSync's Organization into the .R struct +func (o *FieldseekerSync) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Organization = nil + + related, err := o.Organization(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.FieldseekerSyncs = FieldseekerSyncSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerSync's Organization into the .R struct +func (os FieldseekerSyncSlice) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + organizations, err := os.Organization(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range organizations { + + if !(o.OrganizationID == rel.ID) { + continue + } + + rel.R.FieldseekerSyncs = append(rel.R.FieldseekerSyncs, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerSyncJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerSyncJoins[Q]) aliasedAs(alias string) fieldseekerSyncJoins[Q] { + return buildFieldseekerSyncJoins[Q](buildFieldseekerSyncColumns(alias), j.typ) +} + +func buildFieldseekerSyncJoins[Q dialect.Joinable](cols fieldseekerSyncColumns, typ string) fieldseekerSyncJoins[Q] { + return fieldseekerSyncJoins[Q]{ + typ: typ, + Organization: modAs[Q, organizationColumns]{ + c: Organizations.Columns, + f: func(to organizationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, Organizations.Name().As(to.Alias())).On( + to.ID.EQ(cols.OrganizationID), + )) + } + + return mods + }, + }, + } +} diff --git a/models/fs_containerrelate.bob.go b/models/fs_containerrelate.bob.go index 06a01240..79942005 100644 --- a/models/fs_containerrelate.bob.go +++ b/models/fs_containerrelate.bob.go @@ -26,7 +26,7 @@ import ( // FSContainerrelate is an object representing the database table. type FSContainerrelate struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Containertype null.Val[string] `db:"containertype" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` @@ -125,7 +125,7 @@ func (fsContainerrelateColumns) AliasedAs(alias string) fsContainerrelateColumns // All values are optional, and do not have to be set // Generated columns are not included type FSContainerrelateSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Containertype omitnull.Val[string] `db:"containertype" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` @@ -147,7 +147,7 @@ type FSContainerrelateSetter struct { func (s FSContainerrelateSetter) SetColumns() []string { vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Containertype.IsUnset() { @@ -205,8 +205,8 @@ func (s FSContainerrelateSetter) SetColumns() []string { } func (s FSContainerrelateSetter) Overwrite(t *FSContainerrelate) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Containertype.IsUnset() { t.Containertype = s.Containertype.MustGetNull() @@ -268,8 +268,8 @@ func (s *FSContainerrelateSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -387,7 +387,7 @@ func (s FSContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSContainerrelateSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -747,7 +747,7 @@ func (o *FSContainerrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os FSContainerrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -765,7 +765,7 @@ func (os FSContainerrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQue func attachFSContainerrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fsContainerrelate0 *FSContainerrelate, organization1 *Organization) (*FSContainerrelate, error) { setter := &FSContainerrelateSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsContainerrelate0.Update(ctx, exec, setter) @@ -812,7 +812,7 @@ func (fsContainerrelate0 *FSContainerrelate) AttachOrganization(ctx context.Cont } type fsContainerrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Containertype psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -838,7 +838,7 @@ func (fsContainerrelateWhere[Q]) AliasedAs(alias string) fsContainerrelateWhere[ func buildFSContainerrelateWhere[Q psql.Filterable](cols fsContainerrelateColumns) fsContainerrelateWhere[Q] { return fsContainerrelateWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Containertype: psql.WhereNull[Q, string](cols.Containertype), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -960,11 +960,8 @@ func (os FSContainerrelateSlice) LoadOrganization(ctx context.Context, exec bob. } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_fieldscoutinglog.bob.go b/models/fs_fieldscoutinglog.bob.go index 1a8d1cea..183f1e11 100644 --- a/models/fs_fieldscoutinglog.bob.go +++ b/models/fs_fieldscoutinglog.bob.go @@ -26,7 +26,7 @@ import ( // FSFieldscoutinglog is an object representing the database table. type FSFieldscoutinglog struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` @@ -116,7 +116,7 @@ func (fsFieldscoutinglogColumns) AliasedAs(alias string) fsFieldscoutinglogColum // All values are optional, and do not have to be set // Generated columns are not included type FSFieldscoutinglogSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` @@ -135,7 +135,7 @@ type FSFieldscoutinglogSetter struct { func (s FSFieldscoutinglogSetter) SetColumns() []string { vals := make([]string, 0, 15) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -184,8 +184,8 @@ func (s FSFieldscoutinglogSetter) SetColumns() []string { } func (s FSFieldscoutinglogSetter) Overwrite(t *FSFieldscoutinglog) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -238,8 +238,8 @@ func (s *FSFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 15) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -339,7 +339,7 @@ func (s FSFieldscoutinglogSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 15) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -678,7 +678,7 @@ func (o *FSFieldscoutinglog) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os FSFieldscoutinglogSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -696,7 +696,7 @@ func (os FSFieldscoutinglogSlice) Organization(mods ...bob.Mod[*dialect.SelectQu func attachFSFieldscoutinglogOrganization0(ctx context.Context, exec bob.Executor, count int, fsFieldscoutinglog0 *FSFieldscoutinglog, organization1 *Organization) (*FSFieldscoutinglog, error) { setter := &FSFieldscoutinglogSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsFieldscoutinglog0.Update(ctx, exec, setter) @@ -743,7 +743,7 @@ func (fsFieldscoutinglog0 *FSFieldscoutinglog) AttachOrganization(ctx context.Co } type fsFieldscoutinglogWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -766,7 +766,7 @@ func (fsFieldscoutinglogWhere[Q]) AliasedAs(alias string) fsFieldscoutinglogWher func buildFSFieldscoutinglogWhere[Q psql.Filterable](cols fsFieldscoutinglogColumns) fsFieldscoutinglogWhere[Q] { return fsFieldscoutinglogWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -885,11 +885,8 @@ func (os FSFieldscoutinglogSlice) LoadOrganization(ctx context.Context, exec bob } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_habitatrelate.bob.go b/models/fs_habitatrelate.bob.go index 4c584a36..a3150c04 100644 --- a/models/fs_habitatrelate.bob.go +++ b/models/fs_habitatrelate.bob.go @@ -26,7 +26,7 @@ import ( // FSHabitatrelate is an object representing the database table. type FSHabitatrelate struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` @@ -119,7 +119,7 @@ func (fsHabitatrelateColumns) AliasedAs(alias string) fsHabitatrelateColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSHabitatrelateSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` @@ -139,7 +139,7 @@ type FSHabitatrelateSetter struct { func (s FSHabitatrelateSetter) SetColumns() []string { vals := make([]string, 0, 16) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -191,8 +191,8 @@ func (s FSHabitatrelateSetter) SetColumns() []string { } func (s FSHabitatrelateSetter) Overwrite(t *FSHabitatrelate) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -248,8 +248,8 @@ func (s *FSHabitatrelateSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 16) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -355,7 +355,7 @@ func (s FSHabitatrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 16) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -701,7 +701,7 @@ func (o *FSHabitatrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Or } func (os FSHabitatrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -719,7 +719,7 @@ func (os FSHabitatrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery func attachFSHabitatrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fsHabitatrelate0 *FSHabitatrelate, organization1 *Organization) (*FSHabitatrelate, error) { setter := &FSHabitatrelateSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsHabitatrelate0.Update(ctx, exec, setter) @@ -766,7 +766,7 @@ func (fsHabitatrelate0 *FSHabitatrelate) AttachOrganization(ctx context.Context, } type fsHabitatrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -790,7 +790,7 @@ func (fsHabitatrelateWhere[Q]) AliasedAs(alias string) fsHabitatrelateWhere[Q] { func buildFSHabitatrelateWhere[Q psql.Filterable](cols fsHabitatrelateColumns) fsHabitatrelateWhere[Q] { return fsHabitatrelateWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -910,11 +910,8 @@ func (os FSHabitatrelateSlice) LoadOrganization(ctx context.Context, exec bob.Ex } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_inspectionsample.bob.go b/models/fs_inspectionsample.bob.go index 95045fd8..57635929 100644 --- a/models/fs_inspectionsample.bob.go +++ b/models/fs_inspectionsample.bob.go @@ -26,7 +26,7 @@ import ( // FSInspectionsample is an object representing the database table. type FSInspectionsample struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` @@ -125,7 +125,7 @@ func (fsInspectionsampleColumns) AliasedAs(alias string) fsInspectionsampleColum // All values are optional, and do not have to be set // Generated columns are not included type FSInspectionsampleSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` @@ -147,7 +147,7 @@ type FSInspectionsampleSetter struct { func (s FSInspectionsampleSetter) SetColumns() []string { vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -205,8 +205,8 @@ func (s FSInspectionsampleSetter) SetColumns() []string { } func (s FSInspectionsampleSetter) Overwrite(t *FSInspectionsample) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -268,8 +268,8 @@ func (s *FSInspectionsampleSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -387,7 +387,7 @@ func (s FSInspectionsampleSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -747,7 +747,7 @@ func (o *FSInspectionsample) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os FSInspectionsampleSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -765,7 +765,7 @@ func (os FSInspectionsampleSlice) Organization(mods ...bob.Mod[*dialect.SelectQu func attachFSInspectionsampleOrganization0(ctx context.Context, exec bob.Executor, count int, fsInspectionsample0 *FSInspectionsample, organization1 *Organization) (*FSInspectionsample, error) { setter := &FSInspectionsampleSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsInspectionsample0.Update(ctx, exec, setter) @@ -812,7 +812,7 @@ func (fsInspectionsample0 *FSInspectionsample) AttachOrganization(ctx context.Co } type fsInspectionsampleWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -838,7 +838,7 @@ func (fsInspectionsampleWhere[Q]) AliasedAs(alias string) fsInspectionsampleWher func buildFSInspectionsampleWhere[Q psql.Filterable](cols fsInspectionsampleColumns) fsInspectionsampleWhere[Q] { return fsInspectionsampleWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -960,11 +960,8 @@ func (os FSInspectionsampleSlice) LoadOrganization(ctx context.Context, exec bob } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_inspectionsampledetail.bob.go b/models/fs_inspectionsampledetail.bob.go index b1a4bd68..13855029 100644 --- a/models/fs_inspectionsampledetail.bob.go +++ b/models/fs_inspectionsampledetail.bob.go @@ -26,7 +26,7 @@ import ( // FSInspectionsampledetail is an object representing the database table. type FSInspectionsampledetail struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Comments null.Val[string] `db:"comments" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` @@ -158,7 +158,7 @@ func (fsInspectionsampledetailColumns) AliasedAs(alias string) fsInspectionsampl // All values are optional, and do not have to be set // Generated columns are not included type FSInspectionsampledetailSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Comments omitnull.Val[string] `db:"comments" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` @@ -191,7 +191,7 @@ type FSInspectionsampledetailSetter struct { func (s FSInspectionsampledetailSetter) SetColumns() []string { vals := make([]string, 0, 29) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Comments.IsUnset() { @@ -282,8 +282,8 @@ func (s FSInspectionsampledetailSetter) SetColumns() []string { } func (s FSInspectionsampledetailSetter) Overwrite(t *FSInspectionsampledetail) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Comments.IsUnset() { t.Comments = s.Comments.MustGetNull() @@ -378,8 +378,8 @@ func (s *FSInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 29) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -563,7 +563,7 @@ func (s FSInspectionsampledetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery func (s FSInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 29) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1000,7 +1000,7 @@ func (o *FSInspectionsampledetail) Organization(mods ...bob.Mod[*dialect.SelectQ } func (os FSInspectionsampledetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1018,7 +1018,7 @@ func (os FSInspectionsampledetailSlice) Organization(mods ...bob.Mod[*dialect.Se func attachFSInspectionsampledetailOrganization0(ctx context.Context, exec bob.Executor, count int, fsInspectionsampledetail0 *FSInspectionsampledetail, organization1 *Organization) (*FSInspectionsampledetail, error) { setter := &FSInspectionsampledetailSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsInspectionsampledetail0.Update(ctx, exec, setter) @@ -1065,7 +1065,7 @@ func (fsInspectionsampledetail0 *FSInspectionsampledetail) AttachOrganization(ct } type fsInspectionsampledetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -1102,7 +1102,7 @@ func (fsInspectionsampledetailWhere[Q]) AliasedAs(alias string) fsInspectionsamp func buildFSInspectionsampledetailWhere[Q psql.Filterable](cols fsInspectionsampledetailColumns) fsInspectionsampledetailWhere[Q] { return fsInspectionsampledetailWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1235,11 +1235,8 @@ func (os FSInspectionsampledetailSlice) LoadOrganization(ctx context.Context, ex } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_linelocation.bob.go b/models/fs_linelocation.bob.go index 673d4d94..bb34b53f 100644 --- a/models/fs_linelocation.bob.go +++ b/models/fs_linelocation.bob.go @@ -26,7 +26,7 @@ import ( // FSLinelocation is an object representing the database table. type FSLinelocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Acres null.Val[float64] `db:"acres" ` Active null.Val[int16] `db:"active" ` @@ -227,7 +227,7 @@ func (fsLinelocationColumns) AliasedAs(alias string) fsLinelocationColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSLinelocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Acres omitnull.Val[float64] `db:"acres" ` Active omitnull.Val[int16] `db:"active" ` @@ -283,7 +283,7 @@ type FSLinelocationSetter struct { func (s FSLinelocationSetter) SetColumns() []string { vals := make([]string, 0, 52) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -443,8 +443,8 @@ func (s FSLinelocationSetter) SetColumns() []string { } func (s FSLinelocationSetter) Overwrite(t *FSLinelocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -608,8 +608,8 @@ func (s *FSLinelocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 52) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -931,7 +931,7 @@ func (s FSLinelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSLinelocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 52) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1529,7 +1529,7 @@ func (o *FSLinelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Org } func (os FSLinelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1547,7 +1547,7 @@ func (os FSLinelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery] func attachFSLinelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsLinelocation0 *FSLinelocation, organization1 *Organization) (*FSLinelocation, error) { setter := &FSLinelocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsLinelocation0.Update(ctx, exec, setter) @@ -1594,7 +1594,7 @@ func (fsLinelocation0 *FSLinelocation) AttachOrganization(ctx context.Context, e } type fsLinelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Acres psql.WhereNullMod[Q, float64] Active psql.WhereNullMod[Q, int16] @@ -1654,7 +1654,7 @@ func (fsLinelocationWhere[Q]) AliasedAs(alias string) fsLinelocationWhere[Q] { func buildFSLinelocationWhere[Q psql.Filterable](cols fsLinelocationColumns) fsLinelocationWhere[Q] { return fsLinelocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Acres: psql.WhereNull[Q, float64](cols.Acres), Active: psql.WhereNull[Q, int16](cols.Active), @@ -1810,11 +1810,8 @@ func (os FSLinelocationSlice) LoadOrganization(ctx context.Context, exec bob.Exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_locationtracking.bob.go b/models/fs_locationtracking.bob.go index 06378f5e..02bc19b2 100644 --- a/models/fs_locationtracking.bob.go +++ b/models/fs_locationtracking.bob.go @@ -26,7 +26,7 @@ import ( // FSLocationtracking is an object representing the database table. type FSLocationtracking struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accuracy null.Val[float64] `db:"accuracy" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` @@ -119,7 +119,7 @@ func (fsLocationtrackingColumns) AliasedAs(alias string) fsLocationtrackingColum // All values are optional, and do not have to be set // Generated columns are not included type FSLocationtrackingSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accuracy omitnull.Val[float64] `db:"accuracy" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` @@ -139,7 +139,7 @@ type FSLocationtrackingSetter struct { func (s FSLocationtrackingSetter) SetColumns() []string { vals := make([]string, 0, 16) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accuracy.IsUnset() { @@ -191,8 +191,8 @@ func (s FSLocationtrackingSetter) SetColumns() []string { } func (s FSLocationtrackingSetter) Overwrite(t *FSLocationtracking) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accuracy.IsUnset() { t.Accuracy = s.Accuracy.MustGetNull() @@ -248,8 +248,8 @@ func (s *FSLocationtrackingSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 16) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -355,7 +355,7 @@ func (s FSLocationtrackingSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 16) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -701,7 +701,7 @@ func (o *FSLocationtracking) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os FSLocationtrackingSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -719,7 +719,7 @@ func (os FSLocationtrackingSlice) Organization(mods ...bob.Mod[*dialect.SelectQu func attachFSLocationtrackingOrganization0(ctx context.Context, exec bob.Executor, count int, fsLocationtracking0 *FSLocationtracking, organization1 *Organization) (*FSLocationtracking, error) { setter := &FSLocationtrackingSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsLocationtracking0.Update(ctx, exec, setter) @@ -766,7 +766,7 @@ func (fsLocationtracking0 *FSLocationtracking) AttachOrganization(ctx context.Co } type fsLocationtrackingWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accuracy psql.WhereNullMod[Q, float64] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -790,7 +790,7 @@ func (fsLocationtrackingWhere[Q]) AliasedAs(alias string) fsLocationtrackingWher func buildFSLocationtrackingWhere[Q psql.Filterable](cols fsLocationtrackingColumns) fsLocationtrackingWhere[Q] { return fsLocationtrackingWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accuracy: psql.WhereNull[Q, float64](cols.Accuracy), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -910,11 +910,8 @@ func (os FSLocationtrackingSlice) LoadOrganization(ctx context.Context, exec bob } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_mosquitoinspection.bob.go b/models/fs_mosquitoinspection.bob.go index 50c4d1e4..4ad65076 100644 --- a/models/fs_mosquitoinspection.bob.go +++ b/models/fs_mosquitoinspection.bob.go @@ -26,7 +26,7 @@ import ( // FSMosquitoinspection is an object representing the database table. type FSMosquitoinspection struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Actiontaken null.Val[string] `db:"actiontaken" ` Activity null.Val[string] `db:"activity" ` Adultact null.Val[string] `db:"adultact" ` @@ -254,7 +254,7 @@ func (fsMosquitoinspectionColumns) AliasedAs(alias string) fsMosquitoinspectionC // All values are optional, and do not have to be set // Generated columns are not included type FSMosquitoinspectionSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Actiontaken omitnull.Val[string] `db:"actiontaken" ` Activity omitnull.Val[string] `db:"activity" ` Adultact omitnull.Val[string] `db:"adultact" ` @@ -319,7 +319,7 @@ type FSMosquitoinspectionSetter struct { func (s FSMosquitoinspectionSetter) SetColumns() []string { vals := make([]string, 0, 61) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Actiontaken.IsUnset() { @@ -506,8 +506,8 @@ func (s FSMosquitoinspectionSetter) SetColumns() []string { } func (s FSMosquitoinspectionSetter) Overwrite(t *FSMosquitoinspection) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Actiontaken.IsUnset() { t.Actiontaken = s.Actiontaken.MustGetNull() @@ -698,8 +698,8 @@ func (s *FSMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 61) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1075,7 +1075,7 @@ func (s FSMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 61) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1736,7 +1736,7 @@ func (o *FSMosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery } func (os FSMosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1754,7 +1754,7 @@ func (os FSMosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.Select func attachFSMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsMosquitoinspection0 *FSMosquitoinspection, organization1 *Organization) (*FSMosquitoinspection, error) { setter := &FSMosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsMosquitoinspection0.Update(ctx, exec, setter) @@ -1801,7 +1801,7 @@ func (fsMosquitoinspection0 *FSMosquitoinspection) AttachOrganization(ctx contex } type fsMosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Actiontaken psql.WhereNullMod[Q, string] Activity psql.WhereNullMod[Q, string] Adultact psql.WhereNullMod[Q, string] @@ -1870,7 +1870,7 @@ func (fsMosquitoinspectionWhere[Q]) AliasedAs(alias string) fsMosquitoinspection func buildFSMosquitoinspectionWhere[Q psql.Filterable](cols fsMosquitoinspectionColumns) fsMosquitoinspectionWhere[Q] { return fsMosquitoinspectionWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), Activity: psql.WhereNull[Q, string](cols.Activity), Adultact: psql.WhereNull[Q, string](cols.Adultact), @@ -2035,11 +2035,8 @@ func (os FSMosquitoinspectionSlice) LoadOrganization(ctx context.Context, exec b } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_pointlocation.bob.go b/models/fs_pointlocation.bob.go index 5ba71ea6..5259535d 100644 --- a/models/fs_pointlocation.bob.go +++ b/models/fs_pointlocation.bob.go @@ -26,7 +26,7 @@ import ( // FSPointlocation is an object representing the database table. type FSPointlocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Active null.Val[int16] `db:"active" ` Comments null.Val[string] `db:"comments" ` @@ -215,7 +215,7 @@ func (fsPointlocationColumns) AliasedAs(alias string) fsPointlocationColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSPointlocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Active omitnull.Val[int16] `db:"active" ` Comments omitnull.Val[string] `db:"comments" ` @@ -267,7 +267,7 @@ type FSPointlocationSetter struct { func (s FSPointlocationSetter) SetColumns() []string { vals := make([]string, 0, 48) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -415,8 +415,8 @@ func (s FSPointlocationSetter) SetColumns() []string { } func (s FSPointlocationSetter) Overwrite(t *FSPointlocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -568,8 +568,8 @@ func (s *FSPointlocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 48) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -867,7 +867,7 @@ func (s FSPointlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSPointlocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 48) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1437,7 +1437,7 @@ func (o *FSPointlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Or } func (os FSPointlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1455,7 +1455,7 @@ func (os FSPointlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery func attachFSPointlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsPointlocation0 *FSPointlocation, organization1 *Organization) (*FSPointlocation, error) { setter := &FSPointlocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsPointlocation0.Update(ctx, exec, setter) @@ -1502,7 +1502,7 @@ func (fsPointlocation0 *FSPointlocation) AttachOrganization(ctx context.Context, } type fsPointlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1558,7 +1558,7 @@ func (fsPointlocationWhere[Q]) AliasedAs(alias string) fsPointlocationWhere[Q] { func buildFSPointlocationWhere[Q psql.Filterable](cols fsPointlocationColumns) fsPointlocationWhere[Q] { return fsPointlocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1710,11 +1710,8 @@ func (os FSPointlocationSlice) LoadOrganization(ctx context.Context, exec bob.Ex } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_polygonlocation.bob.go b/models/fs_polygonlocation.bob.go index 55c8b332..3af7e32c 100644 --- a/models/fs_polygonlocation.bob.go +++ b/models/fs_polygonlocation.bob.go @@ -26,7 +26,7 @@ import ( // FSPolygonlocation is an object representing the database table. type FSPolygonlocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Acres null.Val[float64] `db:"acres" ` Active null.Val[int16] `db:"active" ` @@ -209,7 +209,7 @@ func (fsPolygonlocationColumns) AliasedAs(alias string) fsPolygonlocationColumns // All values are optional, and do not have to be set // Generated columns are not included type FSPolygonlocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Acres omitnull.Val[float64] `db:"acres" ` Active omitnull.Val[int16] `db:"active" ` @@ -259,7 +259,7 @@ type FSPolygonlocationSetter struct { func (s FSPolygonlocationSetter) SetColumns() []string { vals := make([]string, 0, 46) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -401,8 +401,8 @@ func (s FSPolygonlocationSetter) SetColumns() []string { } func (s FSPolygonlocationSetter) Overwrite(t *FSPolygonlocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -548,8 +548,8 @@ func (s *FSPolygonlocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 46) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -835,7 +835,7 @@ func (s FSPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 46) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1391,7 +1391,7 @@ func (o *FSPolygonlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os FSPolygonlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1409,7 +1409,7 @@ func (os FSPolygonlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQue func attachFSPolygonlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsPolygonlocation0 *FSPolygonlocation, organization1 *Organization) (*FSPolygonlocation, error) { setter := &FSPolygonlocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsPolygonlocation0.Update(ctx, exec, setter) @@ -1456,7 +1456,7 @@ func (fsPolygonlocation0 *FSPolygonlocation) AttachOrganization(ctx context.Cont } type fsPolygonlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Acres psql.WhereNullMod[Q, float64] Active psql.WhereNullMod[Q, int16] @@ -1510,7 +1510,7 @@ func (fsPolygonlocationWhere[Q]) AliasedAs(alias string) fsPolygonlocationWhere[ func buildFSPolygonlocationWhere[Q psql.Filterable](cols fsPolygonlocationColumns) fsPolygonlocationWhere[Q] { return fsPolygonlocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Acres: psql.WhereNull[Q, float64](cols.Acres), Active: psql.WhereNull[Q, int16](cols.Active), @@ -1660,11 +1660,8 @@ func (os FSPolygonlocationSlice) LoadOrganization(ctx context.Context, exec bob. } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_pool.bob.go b/models/fs_pool.bob.go index 4813495f..408d4693 100644 --- a/models/fs_pool.bob.go +++ b/models/fs_pool.bob.go @@ -26,7 +26,7 @@ import ( // FSPool is an object representing the database table. type FSPool struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Comments null.Val[string] `db:"comments" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` @@ -167,7 +167,7 @@ func (fsPoolColumns) AliasedAs(alias string) fsPoolColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSPoolSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Comments omitnull.Val[string] `db:"comments" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` @@ -203,7 +203,7 @@ type FSPoolSetter struct { func (s FSPoolSetter) SetColumns() []string { vals := make([]string, 0, 32) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Comments.IsUnset() { @@ -303,8 +303,8 @@ func (s FSPoolSetter) SetColumns() []string { } func (s FSPoolSetter) Overwrite(t *FSPool) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Comments.IsUnset() { t.Comments = s.Comments.MustGetNull() @@ -408,8 +408,8 @@ func (s *FSPoolSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 32) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -611,7 +611,7 @@ func (s FSPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSPoolSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 32) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1069,7 +1069,7 @@ func (o *FSPool) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organizatio } func (os FSPoolSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1087,7 +1087,7 @@ func (os FSPoolSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organi func attachFSPoolOrganization0(ctx context.Context, exec bob.Executor, count int, fsPool0 *FSPool, organization1 *Organization) (*FSPool, error) { setter := &FSPoolSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsPool0.Update(ctx, exec, setter) @@ -1134,7 +1134,7 @@ func (fsPool0 *FSPool) AttachOrganization(ctx context.Context, exec bob.Executor } type fsPoolWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -1174,7 +1174,7 @@ func (fsPoolWhere[Q]) AliasedAs(alias string) fsPoolWhere[Q] { func buildFSPoolWhere[Q psql.Filterable](cols fsPoolColumns) fsPoolWhere[Q] { return fsPoolWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1310,11 +1310,8 @@ func (os FSPoolSlice) LoadOrganization(ctx context.Context, exec bob.Executor, m } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_pooldetail.bob.go b/models/fs_pooldetail.bob.go index 2051b6b9..fbadf664 100644 --- a/models/fs_pooldetail.bob.go +++ b/models/fs_pooldetail.bob.go @@ -26,7 +26,7 @@ import ( // FSPooldetail is an object representing the database table. type FSPooldetail struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` @@ -125,7 +125,7 @@ func (fsPooldetailColumns) AliasedAs(alias string) fsPooldetailColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSPooldetailSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` @@ -147,7 +147,7 @@ type FSPooldetailSetter struct { func (s FSPooldetailSetter) SetColumns() []string { vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -205,8 +205,8 @@ func (s FSPooldetailSetter) SetColumns() []string { } func (s FSPooldetailSetter) Overwrite(t *FSPooldetail) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -268,8 +268,8 @@ func (s *FSPooldetailSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -387,7 +387,7 @@ func (s FSPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSPooldetailSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -747,7 +747,7 @@ func (o *FSPooldetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organ } func (os FSPooldetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -765,7 +765,7 @@ func (os FSPooldetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) func attachFSPooldetailOrganization0(ctx context.Context, exec bob.Executor, count int, fsPooldetail0 *FSPooldetail, organization1 *Organization) (*FSPooldetail, error) { setter := &FSPooldetailSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsPooldetail0.Update(ctx, exec, setter) @@ -812,7 +812,7 @@ func (fsPooldetail0 *FSPooldetail) AttachOrganization(ctx context.Context, exec } type fsPooldetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -838,7 +838,7 @@ func (fsPooldetailWhere[Q]) AliasedAs(alias string) fsPooldetailWhere[Q] { func buildFSPooldetailWhere[Q psql.Filterable](cols fsPooldetailColumns) fsPooldetailWhere[Q] { return fsPooldetailWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -960,11 +960,8 @@ func (os FSPooldetailSlice) LoadOrganization(ctx context.Context, exec bob.Execu } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_proposedtreatmentarea.bob.go b/models/fs_proposedtreatmentarea.bob.go index 95450a65..dacf3d55 100644 --- a/models/fs_proposedtreatmentarea.bob.go +++ b/models/fs_proposedtreatmentarea.bob.go @@ -26,7 +26,7 @@ import ( // FSProposedtreatmentarea is an object representing the database table. type FSProposedtreatmentarea struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Acres null.Val[float64] `db:"acres" ` Comments null.Val[string] `db:"comments" ` Completed null.Val[int16] `db:"completed" ` @@ -182,7 +182,7 @@ func (fsProposedtreatmentareaColumns) AliasedAs(alias string) fsProposedtreatmen // All values are optional, and do not have to be set // Generated columns are not included type FSProposedtreatmentareaSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Acres omitnull.Val[float64] `db:"acres" ` Comments omitnull.Val[string] `db:"comments" ` Completed omitnull.Val[int16] `db:"completed" ` @@ -223,7 +223,7 @@ type FSProposedtreatmentareaSetter struct { func (s FSProposedtreatmentareaSetter) SetColumns() []string { vals := make([]string, 0, 37) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Acres.IsUnset() { @@ -338,8 +338,8 @@ func (s FSProposedtreatmentareaSetter) SetColumns() []string { } func (s FSProposedtreatmentareaSetter) Overwrite(t *FSProposedtreatmentarea) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Acres.IsUnset() { t.Acres = s.Acres.MustGetNull() @@ -458,8 +458,8 @@ func (s *FSProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 37) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -691,7 +691,7 @@ func (s FSProposedtreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] func (s FSProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 37) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1184,7 +1184,7 @@ func (o *FSProposedtreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQu } func (os FSProposedtreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1202,7 +1202,7 @@ func (os FSProposedtreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.Sel func attachFSProposedtreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fsProposedtreatmentarea0 *FSProposedtreatmentarea, organization1 *Organization) (*FSProposedtreatmentarea, error) { setter := &FSProposedtreatmentareaSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsProposedtreatmentarea0.Update(ctx, exec, setter) @@ -1249,7 +1249,7 @@ func (fsProposedtreatmentarea0 *FSProposedtreatmentarea) AttachOrganization(ctx } type fsProposedtreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Acres psql.WhereNullMod[Q, float64] Comments psql.WhereNullMod[Q, string] Completed psql.WhereNullMod[Q, int16] @@ -1294,7 +1294,7 @@ func (fsProposedtreatmentareaWhere[Q]) AliasedAs(alias string) fsProposedtreatme func buildFSProposedtreatmentareaWhere[Q psql.Filterable](cols fsProposedtreatmentareaColumns) fsProposedtreatmentareaWhere[Q] { return fsProposedtreatmentareaWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Acres: psql.WhereNull[Q, float64](cols.Acres), Comments: psql.WhereNull[Q, string](cols.Comments), Completed: psql.WhereNull[Q, int16](cols.Completed), @@ -1435,11 +1435,8 @@ func (os FSProposedtreatmentareaSlice) LoadOrganization(ctx context.Context, exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_qamosquitoinspection.bob.go b/models/fs_qamosquitoinspection.bob.go index 1cf036e5..11f94e0b 100644 --- a/models/fs_qamosquitoinspection.bob.go +++ b/models/fs_qamosquitoinspection.bob.go @@ -26,7 +26,7 @@ import ( // FSQamosquitoinspection is an object representing the database table. type FSQamosquitoinspection struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Acresbreeding null.Val[float64] `db:"acresbreeding" ` Actiontaken null.Val[string] `db:"actiontaken" ` Adultactivity null.Val[int16] `db:"adultactivity" ` @@ -269,7 +269,7 @@ func (fsQamosquitoinspectionColumns) AliasedAs(alias string) fsQamosquitoinspect // All values are optional, and do not have to be set // Generated columns are not included type FSQamosquitoinspectionSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Acresbreeding omitnull.Val[float64] `db:"acresbreeding" ` Actiontaken omitnull.Val[string] `db:"actiontaken" ` Adultactivity omitnull.Val[int16] `db:"adultactivity" ` @@ -339,7 +339,7 @@ type FSQamosquitoinspectionSetter struct { func (s FSQamosquitoinspectionSetter) SetColumns() []string { vals := make([]string, 0, 66) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Acresbreeding.IsUnset() { @@ -541,8 +541,8 @@ func (s FSQamosquitoinspectionSetter) SetColumns() []string { } func (s FSQamosquitoinspectionSetter) Overwrite(t *FSQamosquitoinspection) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Acresbreeding.IsUnset() { t.Acresbreeding = s.Acresbreeding.MustGetNull() @@ -748,8 +748,8 @@ func (s *FSQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 66) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1155,7 +1155,7 @@ func (s FSQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] func (s FSQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 66) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1851,7 +1851,7 @@ func (o *FSQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQue } func (os FSQamosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1869,7 +1869,7 @@ func (os FSQamosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.Sele func attachFSQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsQamosquitoinspection0 *FSQamosquitoinspection, organization1 *Organization) (*FSQamosquitoinspection, error) { setter := &FSQamosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsQamosquitoinspection0.Update(ctx, exec, setter) @@ -1916,7 +1916,7 @@ func (fsQamosquitoinspection0 *FSQamosquitoinspection) AttachOrganization(ctx co } type fsQamosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Acresbreeding psql.WhereNullMod[Q, float64] Actiontaken psql.WhereNullMod[Q, string] Adultactivity psql.WhereNullMod[Q, int16] @@ -1990,7 +1990,7 @@ func (fsQamosquitoinspectionWhere[Q]) AliasedAs(alias string) fsQamosquitoinspec func buildFSQamosquitoinspectionWhere[Q psql.Filterable](cols fsQamosquitoinspectionColumns) fsQamosquitoinspectionWhere[Q] { return fsQamosquitoinspectionWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Acresbreeding: psql.WhereNull[Q, float64](cols.Acresbreeding), Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), Adultactivity: psql.WhereNull[Q, int16](cols.Adultactivity), @@ -2160,11 +2160,8 @@ func (os FSQamosquitoinspectionSlice) LoadOrganization(ctx context.Context, exec } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_rodentlocation.bob.go b/models/fs_rodentlocation.bob.go index 3fb455b9..9ce007cb 100644 --- a/models/fs_rodentlocation.bob.go +++ b/models/fs_rodentlocation.bob.go @@ -26,7 +26,7 @@ import ( // FSRodentlocation is an object representing the database table. type FSRodentlocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Active null.Val[int16] `db:"active" ` Comments null.Val[string] `db:"comments" ` @@ -173,7 +173,7 @@ func (fsRodentlocationColumns) AliasedAs(alias string) fsRodentlocationColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSRodentlocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Active omitnull.Val[int16] `db:"active" ` Comments omitnull.Val[string] `db:"comments" ` @@ -211,7 +211,7 @@ type FSRodentlocationSetter struct { func (s FSRodentlocationSetter) SetColumns() []string { vals := make([]string, 0, 34) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -317,8 +317,8 @@ func (s FSRodentlocationSetter) SetColumns() []string { } func (s FSRodentlocationSetter) Overwrite(t *FSRodentlocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -428,8 +428,8 @@ func (s *FSRodentlocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 34) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -643,7 +643,7 @@ func (s FSRodentlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 34) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1115,7 +1115,7 @@ func (o *FSRodentlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O } func (os FSRodentlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1133,7 +1133,7 @@ func (os FSRodentlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuer func attachFSRodentlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsRodentlocation0 *FSRodentlocation, organization1 *Organization) (*FSRodentlocation, error) { setter := &FSRodentlocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsRodentlocation0.Update(ctx, exec, setter) @@ -1180,7 +1180,7 @@ func (fsRodentlocation0 *FSRodentlocation) AttachOrganization(ctx context.Contex } type fsRodentlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1222,7 +1222,7 @@ func (fsRodentlocationWhere[Q]) AliasedAs(alias string) fsRodentlocationWhere[Q] func buildFSRodentlocationWhere[Q psql.Filterable](cols fsRodentlocationColumns) fsRodentlocationWhere[Q] { return fsRodentlocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1360,11 +1360,8 @@ func (os FSRodentlocationSlice) LoadOrganization(ctx context.Context, exec bob.E } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_samplecollection.bob.go b/models/fs_samplecollection.bob.go index 495a1784..dfb4e386 100644 --- a/models/fs_samplecollection.bob.go +++ b/models/fs_samplecollection.bob.go @@ -26,7 +26,7 @@ import ( // FSSamplecollection is an object representing the database table. type FSSamplecollection struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Activity null.Val[string] `db:"activity" ` Avetemp null.Val[float64] `db:"avetemp" ` Chickenid null.Val[string] `db:"chickenid" ` @@ -221,7 +221,7 @@ func (fsSamplecollectionColumns) AliasedAs(alias string) fsSamplecollectionColum // All values are optional, and do not have to be set // Generated columns are not included type FSSamplecollectionSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Activity omitnull.Val[string] `db:"activity" ` Avetemp omitnull.Val[float64] `db:"avetemp" ` Chickenid omitnull.Val[string] `db:"chickenid" ` @@ -275,7 +275,7 @@ type FSSamplecollectionSetter struct { func (s FSSamplecollectionSetter) SetColumns() []string { vals := make([]string, 0, 50) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Activity.IsUnset() { @@ -429,8 +429,8 @@ func (s FSSamplecollectionSetter) SetColumns() []string { } func (s FSSamplecollectionSetter) Overwrite(t *FSSamplecollection) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Activity.IsUnset() { t.Activity = s.Activity.MustGetNull() @@ -588,8 +588,8 @@ func (s *FSSamplecollectionSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 50) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -899,7 +899,7 @@ func (s FSSamplecollectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSSamplecollectionSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 50) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1483,7 +1483,7 @@ func (o *FSSamplecollection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os FSSamplecollectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1501,7 +1501,7 @@ func (os FSSamplecollectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQu func attachFSSamplecollectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsSamplecollection0 *FSSamplecollection, organization1 *Organization) (*FSSamplecollection, error) { setter := &FSSamplecollectionSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsSamplecollection0.Update(ctx, exec, setter) @@ -1548,7 +1548,7 @@ func (fsSamplecollection0 *FSSamplecollection) AttachOrganization(ctx context.Co } type fsSamplecollectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Activity psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] Chickenid psql.WhereNullMod[Q, string] @@ -1606,7 +1606,7 @@ func (fsSamplecollectionWhere[Q]) AliasedAs(alias string) fsSamplecollectionWher func buildFSSamplecollectionWhere[Q psql.Filterable](cols fsSamplecollectionColumns) fsSamplecollectionWhere[Q] { return fsSamplecollectionWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Activity: psql.WhereNull[Q, string](cols.Activity), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Chickenid: psql.WhereNull[Q, string](cols.Chickenid), @@ -1760,11 +1760,8 @@ func (os FSSamplecollectionSlice) LoadOrganization(ctx context.Context, exec bob } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_samplelocation.bob.go b/models/fs_samplelocation.bob.go index 04f4c604..10b79749 100644 --- a/models/fs_samplelocation.bob.go +++ b/models/fs_samplelocation.bob.go @@ -26,7 +26,7 @@ import ( // FSSamplelocation is an object representing the database table. type FSSamplelocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Active null.Val[int16] `db:"active" ` Comments null.Val[string] `db:"comments" ` @@ -155,7 +155,7 @@ func (fsSamplelocationColumns) AliasedAs(alias string) fsSamplelocationColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSSamplelocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Active omitnull.Val[int16] `db:"active" ` Comments omitnull.Val[string] `db:"comments" ` @@ -187,7 +187,7 @@ type FSSamplelocationSetter struct { func (s FSSamplelocationSetter) SetColumns() []string { vals := make([]string, 0, 28) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -275,8 +275,8 @@ func (s FSSamplelocationSetter) SetColumns() []string { } func (s FSSamplelocationSetter) Overwrite(t *FSSamplelocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -368,8 +368,8 @@ func (s *FSSamplelocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 28) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -547,7 +547,7 @@ func (s FSSamplelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSSamplelocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 28) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -977,7 +977,7 @@ func (o *FSSamplelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O } func (os FSSamplelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -995,7 +995,7 @@ func (os FSSamplelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuer func attachFSSamplelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsSamplelocation0 *FSSamplelocation, organization1 *Organization) (*FSSamplelocation, error) { setter := &FSSamplelocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsSamplelocation0.Update(ctx, exec, setter) @@ -1042,7 +1042,7 @@ func (fsSamplelocation0 *FSSamplelocation) AttachOrganization(ctx context.Contex } type fsSamplelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1078,7 +1078,7 @@ func (fsSamplelocationWhere[Q]) AliasedAs(alias string) fsSamplelocationWhere[Q] func buildFSSamplelocationWhere[Q psql.Filterable](cols fsSamplelocationColumns) fsSamplelocationWhere[Q] { return fsSamplelocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1210,11 +1210,8 @@ func (os FSSamplelocationSlice) LoadOrganization(ctx context.Context, exec bob.E } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_servicerequest.bob.go b/models/fs_servicerequest.bob.go index 9367b693..fbb63430 100644 --- a/models/fs_servicerequest.bob.go +++ b/models/fs_servicerequest.bob.go @@ -26,7 +26,7 @@ import ( // FSServicerequest is an object representing the database table. type FSServicerequest struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accepted null.Val[int16] `db:"accepted" ` Acceptedby null.Val[string] `db:"acceptedby" ` Accepteddate null.Val[int64] `db:"accepteddate" ` @@ -341,7 +341,7 @@ func (fsServicerequestColumns) AliasedAs(alias string) fsServicerequestColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSServicerequestSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accepted omitnull.Val[int16] `db:"accepted" ` Acceptedby omitnull.Val[string] `db:"acceptedby" ` Accepteddate omitnull.Val[int64] `db:"accepteddate" ` @@ -435,7 +435,7 @@ type FSServicerequestSetter struct { func (s FSServicerequestSetter) SetColumns() []string { vals := make([]string, 0, 90) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accepted.IsUnset() { @@ -709,8 +709,8 @@ func (s FSServicerequestSetter) SetColumns() []string { } func (s FSServicerequestSetter) Overwrite(t *FSServicerequest) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accepted.IsUnset() { t.Accepted = s.Accepted.MustGetNull() @@ -988,8 +988,8 @@ func (s *FSServicerequestSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 90) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1539,7 +1539,7 @@ func (s FSServicerequestSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSServicerequestSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 90) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -2403,7 +2403,7 @@ func (o *FSServicerequest) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O } func (os FSServicerequestSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -2421,7 +2421,7 @@ func (os FSServicerequestSlice) Organization(mods ...bob.Mod[*dialect.SelectQuer func attachFSServicerequestOrganization0(ctx context.Context, exec bob.Executor, count int, fsServicerequest0 *FSServicerequest, organization1 *Organization) (*FSServicerequest, error) { setter := &FSServicerequestSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsServicerequest0.Update(ctx, exec, setter) @@ -2468,7 +2468,7 @@ func (fsServicerequest0 *FSServicerequest) AttachOrganization(ctx context.Contex } type fsServicerequestWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accepted psql.WhereNullMod[Q, int16] Acceptedby psql.WhereNullMod[Q, string] Accepteddate psql.WhereNullMod[Q, int64] @@ -2566,7 +2566,7 @@ func (fsServicerequestWhere[Q]) AliasedAs(alias string) fsServicerequestWhere[Q] func buildFSServicerequestWhere[Q psql.Filterable](cols fsServicerequestColumns) fsServicerequestWhere[Q] { return fsServicerequestWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accepted: psql.WhereNull[Q, int16](cols.Accepted), Acceptedby: psql.WhereNull[Q, string](cols.Acceptedby), Accepteddate: psql.WhereNull[Q, int64](cols.Accepteddate), @@ -2760,11 +2760,8 @@ func (os FSServicerequestSlice) LoadOrganization(ctx context.Context, exec bob.E } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_speciesabundance.bob.go b/models/fs_speciesabundance.bob.go index f45b2515..f227471f 100644 --- a/models/fs_speciesabundance.bob.go +++ b/models/fs_speciesabundance.bob.go @@ -26,7 +26,7 @@ import ( // FSSpeciesabundance is an object representing the database table. type FSSpeciesabundance struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Bloodedfem null.Val[int16] `db:"bloodedfem" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` @@ -170,7 +170,7 @@ func (fsSpeciesabundanceColumns) AliasedAs(alias string) fsSpeciesabundanceColum // All values are optional, and do not have to be set // Generated columns are not included type FSSpeciesabundanceSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Bloodedfem omitnull.Val[int16] `db:"bloodedfem" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` @@ -207,7 +207,7 @@ type FSSpeciesabundanceSetter struct { func (s FSSpeciesabundanceSetter) SetColumns() []string { vals := make([]string, 0, 33) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Bloodedfem.IsUnset() { @@ -310,8 +310,8 @@ func (s FSSpeciesabundanceSetter) SetColumns() []string { } func (s FSSpeciesabundanceSetter) Overwrite(t *FSSpeciesabundance) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Bloodedfem.IsUnset() { t.Bloodedfem = s.Bloodedfem.MustGetNull() @@ -418,8 +418,8 @@ func (s *FSSpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 33) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -627,7 +627,7 @@ func (s FSSpeciesabundanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSSpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 33) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1092,7 +1092,7 @@ func (o *FSSpeciesabundance) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os FSSpeciesabundanceSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1110,7 +1110,7 @@ func (os FSSpeciesabundanceSlice) Organization(mods ...bob.Mod[*dialect.SelectQu func attachFSSpeciesabundanceOrganization0(ctx context.Context, exec bob.Executor, count int, fsSpeciesabundance0 *FSSpeciesabundance, organization1 *Organization) (*FSSpeciesabundance, error) { setter := &FSSpeciesabundanceSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsSpeciesabundance0.Update(ctx, exec, setter) @@ -1157,7 +1157,7 @@ func (fsSpeciesabundance0 *FSSpeciesabundance) AttachOrganization(ctx context.Co } type fsSpeciesabundanceWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Bloodedfem psql.WhereNullMod[Q, int16] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -1198,7 +1198,7 @@ func (fsSpeciesabundanceWhere[Q]) AliasedAs(alias string) fsSpeciesabundanceWher func buildFSSpeciesabundanceWhere[Q psql.Filterable](cols fsSpeciesabundanceColumns) fsSpeciesabundanceWhere[Q] { return fsSpeciesabundanceWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Bloodedfem: psql.WhereNull[Q, int16](cols.Bloodedfem), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1335,11 +1335,8 @@ func (os FSSpeciesabundanceSlice) LoadOrganization(ctx context.Context, exec bob } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_stormdrain.bob.go b/models/fs_stormdrain.bob.go index 082a6935..6f736d8f 100644 --- a/models/fs_stormdrain.bob.go +++ b/models/fs_stormdrain.bob.go @@ -26,7 +26,7 @@ import ( // FSStormdrain is an object representing the database table. type FSStormdrain struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` @@ -140,7 +140,7 @@ func (fsStormdrainColumns) AliasedAs(alias string) fsStormdrainColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSStormdrainSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` @@ -167,7 +167,7 @@ type FSStormdrainSetter struct { func (s FSStormdrainSetter) SetColumns() []string { vals := make([]string, 0, 23) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -240,8 +240,8 @@ func (s FSStormdrainSetter) SetColumns() []string { } func (s FSStormdrainSetter) Overwrite(t *FSStormdrain) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -318,8 +318,8 @@ func (s *FSStormdrainSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 23) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -467,7 +467,7 @@ func (s FSStormdrainSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSStormdrainSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 23) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -862,7 +862,7 @@ func (o *FSStormdrain) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organ } func (os FSStormdrainSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -880,7 +880,7 @@ func (os FSStormdrainSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) func attachFSStormdrainOrganization0(ctx context.Context, exec bob.Executor, count int, fsStormdrain0 *FSStormdrain, organization1 *Organization) (*FSStormdrain, error) { setter := &FSStormdrainSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsStormdrain0.Update(ctx, exec, setter) @@ -927,7 +927,7 @@ func (fsStormdrain0 *FSStormdrain) AttachOrganization(ctx context.Context, exec } type fsStormdrainWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -958,7 +958,7 @@ func (fsStormdrainWhere[Q]) AliasedAs(alias string) fsStormdrainWhere[Q] { func buildFSStormdrainWhere[Q psql.Filterable](cols fsStormdrainColumns) fsStormdrainWhere[Q] { return fsStormdrainWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -1085,11 +1085,8 @@ func (os FSStormdrainSlice) LoadOrganization(ctx context.Context, exec bob.Execu } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_timecard.bob.go b/models/fs_timecard.bob.go index a0194144..6cdcc858 100644 --- a/models/fs_timecard.bob.go +++ b/models/fs_timecard.bob.go @@ -26,7 +26,7 @@ import ( // FSTimecard is an object representing the database table. type FSTimecard struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Activity null.Val[string] `db:"activity" ` Comments null.Val[string] `db:"comments" ` Creationdate null.Val[int64] `db:"creationdate" ` @@ -167,7 +167,7 @@ func (fsTimecardColumns) AliasedAs(alias string) fsTimecardColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSTimecardSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Activity omitnull.Val[string] `db:"activity" ` Comments omitnull.Val[string] `db:"comments" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` @@ -203,7 +203,7 @@ type FSTimecardSetter struct { func (s FSTimecardSetter) SetColumns() []string { vals := make([]string, 0, 32) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Activity.IsUnset() { @@ -303,8 +303,8 @@ func (s FSTimecardSetter) SetColumns() []string { } func (s FSTimecardSetter) Overwrite(t *FSTimecard) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Activity.IsUnset() { t.Activity = s.Activity.MustGetNull() @@ -408,8 +408,8 @@ func (s *FSTimecardSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 32) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -611,7 +611,7 @@ func (s FSTimecardSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSTimecardSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 32) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1069,7 +1069,7 @@ func (o *FSTimecard) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organiz } func (os FSTimecardSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1087,7 +1087,7 @@ func (os FSTimecardSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Or func attachFSTimecardOrganization0(ctx context.Context, exec bob.Executor, count int, fsTimecard0 *FSTimecard, organization1 *Organization) (*FSTimecard, error) { setter := &FSTimecardSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsTimecard0.Update(ctx, exec, setter) @@ -1134,7 +1134,7 @@ func (fsTimecard0 *FSTimecard) AttachOrganization(ctx context.Context, exec bob. } type fsTimecardWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Activity psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] @@ -1174,7 +1174,7 @@ func (fsTimecardWhere[Q]) AliasedAs(alias string) fsTimecardWhere[Q] { func buildFSTimecardWhere[Q psql.Filterable](cols fsTimecardColumns) fsTimecardWhere[Q] { return fsTimecardWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Activity: psql.WhereNull[Q, string](cols.Activity), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), @@ -1310,11 +1310,8 @@ func (os FSTimecardSlice) LoadOrganization(ctx context.Context, exec bob.Executo } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_trapdata.bob.go b/models/fs_trapdata.bob.go index e897ec44..02dc6da4 100644 --- a/models/fs_trapdata.bob.go +++ b/models/fs_trapdata.bob.go @@ -26,7 +26,7 @@ import ( // FSTrapdatum is an object representing the database table. type FSTrapdatum struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Avetemp null.Val[float64] `db:"avetemp" ` Comments null.Val[string] `db:"comments" ` Creationdate null.Val[int64] `db:"creationdate" ` @@ -209,7 +209,7 @@ func (fsTrapdatumColumns) AliasedAs(alias string) fsTrapdatumColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSTrapdatumSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Avetemp omitnull.Val[float64] `db:"avetemp" ` Comments omitnull.Val[string] `db:"comments" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` @@ -259,7 +259,7 @@ type FSTrapdatumSetter struct { func (s FSTrapdatumSetter) SetColumns() []string { vals := make([]string, 0, 46) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Avetemp.IsUnset() { @@ -401,8 +401,8 @@ func (s FSTrapdatumSetter) SetColumns() []string { } func (s FSTrapdatumSetter) Overwrite(t *FSTrapdatum) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Avetemp.IsUnset() { t.Avetemp = s.Avetemp.MustGetNull() @@ -548,8 +548,8 @@ func (s *FSTrapdatumSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 46) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -835,7 +835,7 @@ func (s FSTrapdatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 46) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1391,7 +1391,7 @@ func (o *FSTrapdatum) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organi } func (os FSTrapdatumSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1409,7 +1409,7 @@ func (os FSTrapdatumSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O func attachFSTrapdatumOrganization0(ctx context.Context, exec bob.Executor, count int, fsTrapdatum0 *FSTrapdatum, organization1 *Organization) (*FSTrapdatum, error) { setter := &FSTrapdatumSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsTrapdatum0.Update(ctx, exec, setter) @@ -1456,7 +1456,7 @@ func (fsTrapdatum0 *FSTrapdatum) AttachOrganization(ctx context.Context, exec bo } type fsTrapdatumWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Avetemp psql.WhereNullMod[Q, float64] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] @@ -1510,7 +1510,7 @@ func (fsTrapdatumWhere[Q]) AliasedAs(alias string) fsTrapdatumWhere[Q] { func buildFSTrapdatumWhere[Q psql.Filterable](cols fsTrapdatumColumns) fsTrapdatumWhere[Q] { return fsTrapdatumWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), @@ -1660,11 +1660,8 @@ func (os FSTrapdatumSlice) LoadOrganization(ctx context.Context, exec bob.Execut } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_traplocation.bob.go b/models/fs_traplocation.bob.go index 78c09c7f..8d757971 100644 --- a/models/fs_traplocation.bob.go +++ b/models/fs_traplocation.bob.go @@ -26,7 +26,7 @@ import ( // FSTraplocation is an object representing the database table. type FSTraplocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Active null.Val[int16] `db:"active" ` Comments null.Val[string] `db:"comments" ` @@ -173,7 +173,7 @@ func (fsTraplocationColumns) AliasedAs(alias string) fsTraplocationColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSTraplocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Active omitnull.Val[int16] `db:"active" ` Comments omitnull.Val[string] `db:"comments" ` @@ -211,7 +211,7 @@ type FSTraplocationSetter struct { func (s FSTraplocationSetter) SetColumns() []string { vals := make([]string, 0, 34) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -317,8 +317,8 @@ func (s FSTraplocationSetter) SetColumns() []string { } func (s FSTraplocationSetter) Overwrite(t *FSTraplocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -428,8 +428,8 @@ func (s *FSTraplocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 34) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -643,7 +643,7 @@ func (s FSTraplocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSTraplocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 34) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1115,7 +1115,7 @@ func (o *FSTraplocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Org } func (os FSTraplocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1133,7 +1133,7 @@ func (os FSTraplocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery] func attachFSTraplocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsTraplocation0 *FSTraplocation, organization1 *Organization) (*FSTraplocation, error) { setter := &FSTraplocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsTraplocation0.Update(ctx, exec, setter) @@ -1180,7 +1180,7 @@ func (fsTraplocation0 *FSTraplocation) AttachOrganization(ctx context.Context, e } type fsTraplocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1222,7 +1222,7 @@ func (fsTraplocationWhere[Q]) AliasedAs(alias string) fsTraplocationWhere[Q] { func buildFSTraplocationWhere[Q psql.Filterable](cols fsTraplocationColumns) fsTraplocationWhere[Q] { return fsTraplocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1360,11 +1360,8 @@ func (os FSTraplocationSlice) LoadOrganization(ctx context.Context, exec bob.Exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_treatment.bob.go b/models/fs_treatment.bob.go index fffce7e4..4a6d86ce 100644 --- a/models/fs_treatment.bob.go +++ b/models/fs_treatment.bob.go @@ -26,7 +26,7 @@ import ( // FSTreatment is an object representing the database table. type FSTreatment struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Activity null.Val[string] `db:"activity" ` Areaunit null.Val[string] `db:"areaunit" ` Avetemp null.Val[float64] `db:"avetemp" ` @@ -245,7 +245,7 @@ func (fsTreatmentColumns) AliasedAs(alias string) fsTreatmentColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSTreatmentSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Activity omitnull.Val[string] `db:"activity" ` Areaunit omitnull.Val[string] `db:"areaunit" ` Avetemp omitnull.Val[float64] `db:"avetemp" ` @@ -307,7 +307,7 @@ type FSTreatmentSetter struct { func (s FSTreatmentSetter) SetColumns() []string { vals := make([]string, 0, 58) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Activity.IsUnset() { @@ -485,8 +485,8 @@ func (s FSTreatmentSetter) SetColumns() []string { } func (s FSTreatmentSetter) Overwrite(t *FSTreatment) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Activity.IsUnset() { t.Activity = s.Activity.MustGetNull() @@ -668,8 +668,8 @@ func (s *FSTreatmentSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 58) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1027,7 +1027,7 @@ func (s FSTreatmentSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSTreatmentSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 58) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1667,7 +1667,7 @@ func (o *FSTreatment) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organi } func (os FSTreatmentSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1685,7 +1685,7 @@ func (os FSTreatmentSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O func attachFSTreatmentOrganization0(ctx context.Context, exec bob.Executor, count int, fsTreatment0 *FSTreatment, organization1 *Organization) (*FSTreatment, error) { setter := &FSTreatmentSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsTreatment0.Update(ctx, exec, setter) @@ -1732,7 +1732,7 @@ func (fsTreatment0 *FSTreatment) AttachOrganization(ctx context.Context, exec bo } type fsTreatmentWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Activity psql.WhereNullMod[Q, string] Areaunit psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] @@ -1798,7 +1798,7 @@ func (fsTreatmentWhere[Q]) AliasedAs(alias string) fsTreatmentWhere[Q] { func buildFSTreatmentWhere[Q psql.Filterable](cols fsTreatmentColumns) fsTreatmentWhere[Q] { return fsTreatmentWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Activity: psql.WhereNull[Q, string](cols.Activity), Areaunit: psql.WhereNull[Q, string](cols.Areaunit), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), @@ -1960,11 +1960,8 @@ func (os FSTreatmentSlice) LoadOrganization(ctx context.Context, exec bob.Execut } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_treatmentarea.bob.go b/models/fs_treatmentarea.bob.go index fde45600..4a7f76fe 100644 --- a/models/fs_treatmentarea.bob.go +++ b/models/fs_treatmentarea.bob.go @@ -26,7 +26,7 @@ import ( // FSTreatmentarea is an object representing the database table. type FSTreatmentarea struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Comments null.Val[string] `db:"comments" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` @@ -137,7 +137,7 @@ func (fsTreatmentareaColumns) AliasedAs(alias string) fsTreatmentareaColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSTreatmentareaSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Comments omitnull.Val[string] `db:"comments" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` @@ -163,7 +163,7 @@ type FSTreatmentareaSetter struct { func (s FSTreatmentareaSetter) SetColumns() []string { vals := make([]string, 0, 22) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Comments.IsUnset() { @@ -233,8 +233,8 @@ func (s FSTreatmentareaSetter) SetColumns() []string { } func (s FSTreatmentareaSetter) Overwrite(t *FSTreatmentarea) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Comments.IsUnset() { t.Comments = s.Comments.MustGetNull() @@ -308,8 +308,8 @@ func (s *FSTreatmentareaSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 22) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -451,7 +451,7 @@ func (s FSTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 22) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -839,7 +839,7 @@ func (o *FSTreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Or } func (os FSTreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -857,7 +857,7 @@ func (os FSTreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery func attachFSTreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fsTreatmentarea0 *FSTreatmentarea, organization1 *Organization) (*FSTreatmentarea, error) { setter := &FSTreatmentareaSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsTreatmentarea0.Update(ctx, exec, setter) @@ -904,7 +904,7 @@ func (fsTreatmentarea0 *FSTreatmentarea) AttachOrganization(ctx context.Context, } type fsTreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -934,7 +934,7 @@ func (fsTreatmentareaWhere[Q]) AliasedAs(alias string) fsTreatmentareaWhere[Q] { func buildFSTreatmentareaWhere[Q psql.Filterable](cols fsTreatmentareaColumns) fsTreatmentareaWhere[Q] { return fsTreatmentareaWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1060,11 +1060,8 @@ func (os FSTreatmentareaSlice) LoadOrganization(ctx context.Context, exec bob.Ex } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_zones.bob.go b/models/fs_zones.bob.go index 0160b6e4..8610ccdf 100644 --- a/models/fs_zones.bob.go +++ b/models/fs_zones.bob.go @@ -26,7 +26,7 @@ import ( // FSZone is an object representing the database table. type FSZone struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Active null.Val[int64] `db:"active" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` @@ -125,7 +125,7 @@ func (fsZoneColumns) AliasedAs(alias string) fsZoneColumns { // All values are optional, and do not have to be set // Generated columns are not included type FSZoneSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Active omitnull.Val[int64] `db:"active" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` @@ -147,7 +147,7 @@ type FSZoneSetter struct { func (s FSZoneSetter) SetColumns() []string { vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Active.IsUnset() { @@ -205,8 +205,8 @@ func (s FSZoneSetter) SetColumns() []string { } func (s FSZoneSetter) Overwrite(t *FSZone) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Active.IsUnset() { t.Active = s.Active.MustGetNull() @@ -268,8 +268,8 @@ func (s *FSZoneSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -387,7 +387,7 @@ func (s FSZoneSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSZoneSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -747,7 +747,7 @@ func (o *FSZone) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organizatio } func (os FSZoneSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -765,7 +765,7 @@ func (os FSZoneSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organi func attachFSZoneOrganization0(ctx context.Context, exec bob.Executor, count int, fsZone0 *FSZone, organization1 *Organization) (*FSZone, error) { setter := &FSZoneSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsZone0.Update(ctx, exec, setter) @@ -812,7 +812,7 @@ func (fsZone0 *FSZone) AttachOrganization(ctx context.Context, exec bob.Executor } type fsZoneWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Active psql.WhereNullMod[Q, int64] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -838,7 +838,7 @@ func (fsZoneWhere[Q]) AliasedAs(alias string) fsZoneWhere[Q] { func buildFSZoneWhere[Q psql.Filterable](cols fsZoneColumns) fsZoneWhere[Q] { return fsZoneWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Active: psql.WhereNull[Q, int64](cols.Active), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -960,11 +960,8 @@ func (os FSZoneSlice) LoadOrganization(ctx context.Context, exec bob.Executor, m } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/fs_zones2.bob.go b/models/fs_zones2.bob.go index 616f7155..c454f752 100644 --- a/models/fs_zones2.bob.go +++ b/models/fs_zones2.bob.go @@ -26,7 +26,7 @@ import ( // FSZones2 is an object representing the database table. type FSZones2 struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Creationdate null.Val[int64] `db:"creationdate" ` Creator null.Val[string] `db:"creator" ` Editdate null.Val[int64] `db:"editdate" ` @@ -122,7 +122,7 @@ func (fsZones2Columns) AliasedAs(alias string) fsZones2Columns { // All values are optional, and do not have to be set // Generated columns are not included type FSZones2Setter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Creationdate omitnull.Val[int64] `db:"creationdate" ` Creator omitnull.Val[string] `db:"creator" ` Editdate omitnull.Val[int64] `db:"editdate" ` @@ -143,7 +143,7 @@ type FSZones2Setter struct { func (s FSZones2Setter) SetColumns() []string { vals := make([]string, 0, 17) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -198,8 +198,8 @@ func (s FSZones2Setter) SetColumns() []string { } func (s FSZones2Setter) Overwrite(t *FSZones2) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -258,8 +258,8 @@ func (s *FSZones2Setter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 17) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -371,7 +371,7 @@ func (s FSZones2Setter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s FSZones2Setter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 17) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -724,7 +724,7 @@ func (o *FSZones2) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organizat } func (os FSZones2Slice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -742,7 +742,7 @@ func (os FSZones2Slice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Orga func attachFSZones2Organization0(ctx context.Context, exec bob.Executor, count int, fsZones20 *FSZones2, organization1 *Organization) (*FSZones2, error) { setter := &FSZones2Setter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := fsZones20.Update(ctx, exec, setter) @@ -789,7 +789,7 @@ func (fsZones20 *FSZones2) AttachOrganization(ctx context.Context, exec bob.Exec } type fsZones2Where[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -814,7 +814,7 @@ func (fsZones2Where[Q]) AliasedAs(alias string) fsZones2Where[Q] { func buildFSZones2Where[Q psql.Filterable](cols fsZones2Columns) fsZones2Where[Q] { return fsZones2Where[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -935,11 +935,8 @@ func (os FSZones2Slice) LoadOrganization(ctx context.Context, exec bob.Executor, } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_containerrelate.bob.go b/models/history_containerrelate.bob.go index ca5d1343..e035f3a7 100644 --- a/models/history_containerrelate.bob.go +++ b/models/history_containerrelate.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,24 +26,25 @@ import ( // HistoryContainerrelate is an object representing the database table. type HistoryContainerrelate struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Containertype null.Val[string] `db:"containertype" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Inspsampleid null.Val[string] `db:"inspsampleid" ` - Mosquitoinspid null.Val[string] `db:"mosquitoinspid" ` - Objectid int32 `db:"objectid,pk" ` - Treatmentid null.Val[string] `db:"treatmentid" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Containertype null.Val[string] `db:"containertype" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Inspsampleid null.Val[string] `db:"inspsampleid" ` + Mosquitoinspid null.Val[string] `db:"mosquitoinspid" ` + Objectid int32 `db:"objectid,pk" ` + Treatmentid null.Val[string] `db:"treatmentid" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyContainerrelateR `db:"-" ` } @@ -65,7 +67,7 @@ type historyContainerrelateR struct { func buildHistoryContainerrelateColumns(alias string) historyContainerrelateColumns { return historyContainerrelateColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "containertype", "creationdate", "creator", "editdate", "editor", "globalid", "inspsampleid", "mosquitoinspid", "objectid", "treatmentid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "containertype", "creationdate", "creator", "editdate", "editor", "globalid", "inspsampleid", "mosquitoinspid", "objectid", "treatmentid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_containerrelate"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -79,6 +81,7 @@ func buildHistoryContainerrelateColumns(alias string) historyContainerrelateColu Mosquitoinspid: psql.Quote(alias, "mosquitoinspid"), Objectid: psql.Quote(alias, "objectid"), Treatmentid: psql.Quote(alias, "treatmentid"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -103,6 +106,7 @@ type historyContainerrelateColumns struct { Mosquitoinspid psql.Expression Objectid psql.Expression Treatmentid psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -124,29 +128,30 @@ func (historyContainerrelateColumns) AliasedAs(alias string) historyContainerrel // All values are optional, and do not have to be set // Generated columns are not included type HistoryContainerrelateSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Containertype omitnull.Val[string] `db:"containertype" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Inspsampleid omitnull.Val[string] `db:"inspsampleid" ` - Mosquitoinspid omitnull.Val[string] `db:"mosquitoinspid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Treatmentid omitnull.Val[string] `db:"treatmentid" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Containertype omitnull.Val[string] `db:"containertype" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Inspsampleid omitnull.Val[string] `db:"inspsampleid" ` + Mosquitoinspid omitnull.Val[string] `db:"mosquitoinspid" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Treatmentid omitnull.Val[string] `db:"treatmentid" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryContainerrelateSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 19) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Containertype.IsUnset() { @@ -179,6 +184,9 @@ func (s HistoryContainerrelateSetter) SetColumns() []string { if !s.Treatmentid.IsUnset() { vals = append(vals, "treatmentid") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -204,8 +212,8 @@ func (s HistoryContainerrelateSetter) SetColumns() []string { } func (s HistoryContainerrelateSetter) Overwrite(t *HistoryContainerrelate) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Containertype.IsUnset() { t.Containertype = s.Containertype.MustGetNull() @@ -237,6 +245,9 @@ func (s HistoryContainerrelateSetter) Overwrite(t *HistoryContainerrelate) { if !s.Treatmentid.IsUnset() { t.Treatmentid = s.Treatmentid.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -266,9 +277,9 @@ func (s *HistoryContainerrelateSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 19) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -333,48 +344,54 @@ func (s *HistoryContainerrelateSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[11] = psql.Arg(s.Created.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[14] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[15] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[17] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[17] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[18] = psql.Arg(s.Version.MustGet()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -384,9 +401,9 @@ func (s HistoryContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s HistoryContainerrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) + exprs := make([]bob.Expression, 0, 19) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -463,6 +480,13 @@ func (s HistoryContainerrelateSetter) Expressions(prefix ...string) []bob.Expres }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -756,7 +780,7 @@ func (o *HistoryContainerrelate) Organization(mods ...bob.Mod[*dialect.SelectQue } func (os HistoryContainerrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -774,7 +798,7 @@ func (os HistoryContainerrelateSlice) Organization(mods ...bob.Mod[*dialect.Sele func attachHistoryContainerrelateOrganization0(ctx context.Context, exec bob.Executor, count int, historyContainerrelate0 *HistoryContainerrelate, organization1 *Organization) (*HistoryContainerrelate, error) { setter := &HistoryContainerrelateSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyContainerrelate0.Update(ctx, exec, setter) @@ -821,7 +845,7 @@ func (historyContainerrelate0 *HistoryContainerrelate) AttachOrganization(ctx co } type historyContainerrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Containertype psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -832,6 +856,7 @@ type historyContainerrelateWhere[Q psql.Filterable] struct { Mosquitoinspid psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] Treatmentid psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -847,7 +872,7 @@ func (historyContainerrelateWhere[Q]) AliasedAs(alias string) historyContainerre func buildHistoryContainerrelateWhere[Q psql.Filterable](cols historyContainerrelateColumns) historyContainerrelateWhere[Q] { return historyContainerrelateWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Containertype: psql.WhereNull[Q, string](cols.Containertype), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -858,6 +883,7 @@ func buildHistoryContainerrelateWhere[Q psql.Filterable](cols historyContainerre Mosquitoinspid: psql.WhereNull[Q, string](cols.Mosquitoinspid), Objectid: psql.Where[Q, int32](cols.Objectid), Treatmentid: psql.WhereNull[Q, string](cols.Treatmentid), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -969,11 +995,8 @@ func (os HistoryContainerrelateSlice) LoadOrganization(ctx context.Context, exec } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_fieldscoutinglog.bob.go b/models/history_fieldscoutinglog.bob.go index f9c28d8b..90ce6116 100644 --- a/models/history_fieldscoutinglog.bob.go +++ b/models/history_fieldscoutinglog.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,21 +26,22 @@ import ( // HistoryFieldscoutinglog is an object representing the database table. type HistoryFieldscoutinglog struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - Status null.Val[int16] `db:"status" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Objectid int32 `db:"objectid,pk" ` + Status null.Val[int16] `db:"status" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyFieldscoutinglogR `db:"-" ` } @@ -62,7 +64,7 @@ type historyFieldscoutinglogR struct { func buildHistoryFieldscoutinglogColumns(alias string) historyFieldscoutinglogColumns { return historyFieldscoutinglogColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "objectid", "status", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "objectid", "status", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_fieldscoutinglog"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -73,6 +75,7 @@ func buildHistoryFieldscoutinglogColumns(alias string) historyFieldscoutinglogCo Globalid: psql.Quote(alias, "globalid"), Objectid: psql.Quote(alias, "objectid"), Status: psql.Quote(alias, "status"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -94,6 +97,7 @@ type historyFieldscoutinglogColumns struct { Globalid psql.Expression Objectid psql.Expression Status psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -115,26 +119,27 @@ func (historyFieldscoutinglogColumns) AliasedAs(alias string) historyFieldscouti // All values are optional, and do not have to be set // Generated columns are not included type HistoryFieldscoutinglogSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Status omitnull.Val[int16] `db:"status" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Status omitnull.Val[int16] `db:"status" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryFieldscoutinglogSetter) SetColumns() []string { - vals := make([]string, 0, 15) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 16) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -158,6 +163,9 @@ func (s HistoryFieldscoutinglogSetter) SetColumns() []string { if !s.Status.IsUnset() { vals = append(vals, "status") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -183,8 +191,8 @@ func (s HistoryFieldscoutinglogSetter) SetColumns() []string { } func (s HistoryFieldscoutinglogSetter) Overwrite(t *HistoryFieldscoutinglog) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -207,6 +215,9 @@ func (s HistoryFieldscoutinglogSetter) Overwrite(t *HistoryFieldscoutinglog) { if !s.Status.IsUnset() { t.Status = s.Status.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -236,9 +247,9 @@ func (s *HistoryFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 15) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 16) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -285,48 +296,54 @@ func (s *HistoryFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { vals[7] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[8] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[8] = psql.Arg(s.Created.MustGetNull()) } else { vals[8] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[9] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[9] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[10] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[10] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[11] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[11] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[12] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[12] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[13] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[14] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[15] = psql.Arg(s.Version.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -336,9 +353,9 @@ func (s HistoryFieldscoutinglogSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s HistoryFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 15) + exprs := make([]bob.Expression, 0, 16) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -394,6 +411,13 @@ func (s HistoryFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expre }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -687,7 +711,7 @@ func (o *HistoryFieldscoutinglog) Organization(mods ...bob.Mod[*dialect.SelectQu } func (os HistoryFieldscoutinglogSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -705,7 +729,7 @@ func (os HistoryFieldscoutinglogSlice) Organization(mods ...bob.Mod[*dialect.Sel func attachHistoryFieldscoutinglogOrganization0(ctx context.Context, exec bob.Executor, count int, historyFieldscoutinglog0 *HistoryFieldscoutinglog, organization1 *Organization) (*HistoryFieldscoutinglog, error) { setter := &HistoryFieldscoutinglogSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyFieldscoutinglog0.Update(ctx, exec, setter) @@ -752,7 +776,7 @@ func (historyFieldscoutinglog0 *HistoryFieldscoutinglog) AttachOrganization(ctx } type historyFieldscoutinglogWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -760,6 +784,7 @@ type historyFieldscoutinglogWhere[Q psql.Filterable] struct { Globalid psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] Status psql.WhereNullMod[Q, int16] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -775,7 +800,7 @@ func (historyFieldscoutinglogWhere[Q]) AliasedAs(alias string) historyFieldscout func buildHistoryFieldscoutinglogWhere[Q psql.Filterable](cols historyFieldscoutinglogColumns) historyFieldscoutinglogWhere[Q] { return historyFieldscoutinglogWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -783,6 +808,7 @@ func buildHistoryFieldscoutinglogWhere[Q psql.Filterable](cols historyFieldscout Globalid: psql.WhereNull[Q, string](cols.Globalid), Objectid: psql.Where[Q, int32](cols.Objectid), Status: psql.WhereNull[Q, int16](cols.Status), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -894,11 +920,8 @@ func (os HistoryFieldscoutinglogSlice) LoadOrganization(ctx context.Context, exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_habitatrelate.bob.go b/models/history_habitatrelate.bob.go index 061a78d0..5d31843a 100644 --- a/models/history_habitatrelate.bob.go +++ b/models/history_habitatrelate.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,22 +26,23 @@ import ( // HistoryHabitatrelate is an object representing the database table. type HistoryHabitatrelate struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - ForeignID null.Val[string] `db:"foreign_id" ` - Globalid null.Val[string] `db:"globalid" ` - Habitattype null.Val[string] `db:"habitattype" ` - Objectid int32 `db:"objectid,pk" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + ForeignID null.Val[string] `db:"foreign_id" ` + Globalid null.Val[string] `db:"globalid" ` + Habitattype null.Val[string] `db:"habitattype" ` + Objectid int32 `db:"objectid,pk" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyHabitatrelateR `db:"-" ` } @@ -63,7 +65,7 @@ type historyHabitatrelateR struct { func buildHistoryHabitatrelateColumns(alias string) historyHabitatrelateColumns { return historyHabitatrelateColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "foreign_id", "globalid", "habitattype", "objectid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "creationdate", "creator", "editdate", "editor", "foreign_id", "globalid", "habitattype", "objectid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_habitatrelate"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -75,6 +77,7 @@ func buildHistoryHabitatrelateColumns(alias string) historyHabitatrelateColumns Globalid: psql.Quote(alias, "globalid"), Habitattype: psql.Quote(alias, "habitattype"), Objectid: psql.Quote(alias, "objectid"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -97,6 +100,7 @@ type historyHabitatrelateColumns struct { Globalid psql.Expression Habitattype psql.Expression Objectid psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -118,27 +122,28 @@ func (historyHabitatrelateColumns) AliasedAs(alias string) historyHabitatrelateC // All values are optional, and do not have to be set // Generated columns are not included type HistoryHabitatrelateSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - ForeignID omitnull.Val[string] `db:"foreign_id" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitattype omitnull.Val[string] `db:"habitattype" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + ForeignID omitnull.Val[string] `db:"foreign_id" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habitattype omitnull.Val[string] `db:"habitattype" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryHabitatrelateSetter) SetColumns() []string { - vals := make([]string, 0, 16) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 17) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -165,6 +170,9 @@ func (s HistoryHabitatrelateSetter) SetColumns() []string { if s.Objectid.IsValue() { vals = append(vals, "objectid") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -190,8 +198,8 @@ func (s HistoryHabitatrelateSetter) SetColumns() []string { } func (s HistoryHabitatrelateSetter) Overwrite(t *HistoryHabitatrelate) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -217,6 +225,9 @@ func (s HistoryHabitatrelateSetter) Overwrite(t *HistoryHabitatrelate) { if s.Objectid.IsValue() { t.Objectid = s.Objectid.MustGet() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -246,9 +257,9 @@ func (s *HistoryHabitatrelateSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 16) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 17) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -301,48 +312,54 @@ func (s *HistoryHabitatrelateSetter) Apply(q *dialect.InsertQuery) { vals[8] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[9] = psql.Arg(s.Created.MustGetNull()) } else { vals[9] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[10] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[11] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[12] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[12] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[13] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[15] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[15] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[16] = psql.Arg(s.Version.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -352,9 +369,9 @@ func (s HistoryHabitatrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 16) + exprs := make([]bob.Expression, 0, 17) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -417,6 +434,13 @@ func (s HistoryHabitatrelateSetter) Expressions(prefix ...string) []bob.Expressi }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -710,7 +734,7 @@ func (o *HistoryHabitatrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery } func (os HistoryHabitatrelateSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -728,7 +752,7 @@ func (os HistoryHabitatrelateSlice) Organization(mods ...bob.Mod[*dialect.Select func attachHistoryHabitatrelateOrganization0(ctx context.Context, exec bob.Executor, count int, historyHabitatrelate0 *HistoryHabitatrelate, organization1 *Organization) (*HistoryHabitatrelate, error) { setter := &HistoryHabitatrelateSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyHabitatrelate0.Update(ctx, exec, setter) @@ -775,7 +799,7 @@ func (historyHabitatrelate0 *HistoryHabitatrelate) AttachOrganization(ctx contex } type historyHabitatrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -784,6 +808,7 @@ type historyHabitatrelateWhere[Q psql.Filterable] struct { Globalid psql.WhereNullMod[Q, string] Habitattype psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -799,7 +824,7 @@ func (historyHabitatrelateWhere[Q]) AliasedAs(alias string) historyHabitatrelate func buildHistoryHabitatrelateWhere[Q psql.Filterable](cols historyHabitatrelateColumns) historyHabitatrelateWhere[Q] { return historyHabitatrelateWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -808,6 +833,7 @@ func buildHistoryHabitatrelateWhere[Q psql.Filterable](cols historyHabitatrelate Globalid: psql.WhereNull[Q, string](cols.Globalid), Habitattype: psql.WhereNull[Q, string](cols.Habitattype), Objectid: psql.Where[Q, int32](cols.Objectid), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -919,11 +945,8 @@ func (os HistoryHabitatrelateSlice) LoadOrganization(ctx context.Context, exec b } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_inspectionsample.bob.go b/models/history_inspectionsample.bob.go index 8d1b2b52..e1854956 100644 --- a/models/history_inspectionsample.bob.go +++ b/models/history_inspectionsample.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,24 +26,25 @@ import ( // HistoryInspectionsample is an object representing the database table. type HistoryInspectionsample struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Idbytech null.Val[string] `db:"idbytech" ` - InspID null.Val[string] `db:"insp_id" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Sampleid null.Val[string] `db:"sampleid" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Idbytech null.Val[string] `db:"idbytech" ` + InspID null.Val[string] `db:"insp_id" ` + Objectid int32 `db:"objectid,pk" ` + Processed null.Val[int16] `db:"processed" ` + Sampleid null.Val[string] `db:"sampleid" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyInspectionsampleR `db:"-" ` } @@ -65,7 +67,7 @@ type historyInspectionsampleR struct { func buildHistoryInspectionsampleColumns(alias string) historyInspectionsampleColumns { return historyInspectionsampleColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "idbytech", "insp_id", "objectid", "processed", "sampleid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "idbytech", "insp_id", "objectid", "processed", "sampleid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_inspectionsample"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -79,6 +81,7 @@ func buildHistoryInspectionsampleColumns(alias string) historyInspectionsampleCo Objectid: psql.Quote(alias, "objectid"), Processed: psql.Quote(alias, "processed"), Sampleid: psql.Quote(alias, "sampleid"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -103,6 +106,7 @@ type historyInspectionsampleColumns struct { Objectid psql.Expression Processed psql.Expression Sampleid psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -124,29 +128,30 @@ func (historyInspectionsampleColumns) AliasedAs(alias string) historyInspections // All values are optional, and do not have to be set // Generated columns are not included type HistoryInspectionsampleSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Idbytech omitnull.Val[string] `db:"idbytech" ` - InspID omitnull.Val[string] `db:"insp_id" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Idbytech omitnull.Val[string] `db:"idbytech" ` + InspID omitnull.Val[string] `db:"insp_id" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Processed omitnull.Val[int16] `db:"processed" ` + Sampleid omitnull.Val[string] `db:"sampleid" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryInspectionsampleSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 19) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -179,6 +184,9 @@ func (s HistoryInspectionsampleSetter) SetColumns() []string { if !s.Sampleid.IsUnset() { vals = append(vals, "sampleid") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -204,8 +212,8 @@ func (s HistoryInspectionsampleSetter) SetColumns() []string { } func (s HistoryInspectionsampleSetter) Overwrite(t *HistoryInspectionsample) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -237,6 +245,9 @@ func (s HistoryInspectionsampleSetter) Overwrite(t *HistoryInspectionsample) { if !s.Sampleid.IsUnset() { t.Sampleid = s.Sampleid.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -266,9 +277,9 @@ func (s *HistoryInspectionsampleSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 19) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -333,48 +344,54 @@ func (s *HistoryInspectionsampleSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[11] = psql.Arg(s.Created.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[14] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[15] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[17] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[17] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[18] = psql.Arg(s.Version.MustGet()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -384,9 +401,9 @@ func (s HistoryInspectionsampleSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s HistoryInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) + exprs := make([]bob.Expression, 0, 19) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -463,6 +480,13 @@ func (s HistoryInspectionsampleSetter) Expressions(prefix ...string) []bob.Expre }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -756,7 +780,7 @@ func (o *HistoryInspectionsample) Organization(mods ...bob.Mod[*dialect.SelectQu } func (os HistoryInspectionsampleSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -774,7 +798,7 @@ func (os HistoryInspectionsampleSlice) Organization(mods ...bob.Mod[*dialect.Sel func attachHistoryInspectionsampleOrganization0(ctx context.Context, exec bob.Executor, count int, historyInspectionsample0 *HistoryInspectionsample, organization1 *Organization) (*HistoryInspectionsample, error) { setter := &HistoryInspectionsampleSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyInspectionsample0.Update(ctx, exec, setter) @@ -821,7 +845,7 @@ func (historyInspectionsample0 *HistoryInspectionsample) AttachOrganization(ctx } type historyInspectionsampleWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -832,6 +856,7 @@ type historyInspectionsampleWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int32] Processed psql.WhereNullMod[Q, int16] Sampleid psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -847,7 +872,7 @@ func (historyInspectionsampleWhere[Q]) AliasedAs(alias string) historyInspection func buildHistoryInspectionsampleWhere[Q psql.Filterable](cols historyInspectionsampleColumns) historyInspectionsampleWhere[Q] { return historyInspectionsampleWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -858,6 +883,7 @@ func buildHistoryInspectionsampleWhere[Q psql.Filterable](cols historyInspection Objectid: psql.Where[Q, int32](cols.Objectid), Processed: psql.WhereNull[Q, int16](cols.Processed), Sampleid: psql.WhereNull[Q, string](cols.Sampleid), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -969,11 +995,8 @@ func (os HistoryInspectionsampleSlice) LoadOrganization(ctx context.Context, exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_inspectionsampledetail.bob.go b/models/history_inspectionsampledetail.bob.go index 0e294131..1bebd8cd 100644 --- a/models/history_inspectionsampledetail.bob.go +++ b/models/history_inspectionsampledetail.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,35 +26,36 @@ import ( // HistoryInspectionsampledetail is an object representing the database table. type HistoryInspectionsampledetail struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fadultact null.Val[string] `db:"fadultact" ` - Fdomstage null.Val[string] `db:"fdomstage" ` - Feggcount null.Val[int16] `db:"feggcount" ` - Fieldspecies null.Val[string] `db:"fieldspecies" ` - Flarvcount null.Val[int16] `db:"flarvcount" ` - Flstages null.Val[string] `db:"flstages" ` - Fpupcount null.Val[int16] `db:"fpupcount" ` - Globalid null.Val[string] `db:"globalid" ` - InspsampleID null.Val[string] `db:"inspsample_id" ` - Labspecies null.Val[string] `db:"labspecies" ` - Ldomstage null.Val[string] `db:"ldomstage" ` - Leggcount null.Val[int16] `db:"leggcount" ` - Llarvcount null.Val[int16] `db:"llarvcount" ` - Lpupcount null.Val[int16] `db:"lpupcount" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fadultact null.Val[string] `db:"fadultact" ` + Fdomstage null.Val[string] `db:"fdomstage" ` + Feggcount null.Val[int16] `db:"feggcount" ` + Fieldspecies null.Val[string] `db:"fieldspecies" ` + Flarvcount null.Val[int16] `db:"flarvcount" ` + Flstages null.Val[string] `db:"flstages" ` + Fpupcount null.Val[int16] `db:"fpupcount" ` + Globalid null.Val[string] `db:"globalid" ` + InspsampleID null.Val[string] `db:"inspsample_id" ` + Labspecies null.Val[string] `db:"labspecies" ` + Ldomstage null.Val[string] `db:"ldomstage" ` + Leggcount null.Val[int16] `db:"leggcount" ` + Llarvcount null.Val[int16] `db:"llarvcount" ` + Lpupcount null.Val[int16] `db:"lpupcount" ` + Objectid int32 `db:"objectid,pk" ` + Processed null.Val[int16] `db:"processed" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyInspectionsampledetailR `db:"-" ` } @@ -76,7 +78,7 @@ type historyInspectionsampledetailR struct { func buildHistoryInspectionsampledetailColumns(alias string) historyInspectionsampledetailColumns { return historyInspectionsampledetailColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "fadultact", "fdomstage", "feggcount", "fieldspecies", "flarvcount", "flstages", "fpupcount", "globalid", "inspsample_id", "labspecies", "ldomstage", "leggcount", "llarvcount", "lpupcount", "objectid", "processed", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "fadultact", "fdomstage", "feggcount", "fieldspecies", "flarvcount", "flstages", "fpupcount", "globalid", "inspsample_id", "labspecies", "ldomstage", "leggcount", "llarvcount", "lpupcount", "objectid", "processed", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_inspectionsampledetail"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -101,6 +103,7 @@ func buildHistoryInspectionsampledetailColumns(alias string) historyInspectionsa Lpupcount: psql.Quote(alias, "lpupcount"), Objectid: psql.Quote(alias, "objectid"), Processed: psql.Quote(alias, "processed"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -136,6 +139,7 @@ type historyInspectionsampledetailColumns struct { Lpupcount psql.Expression Objectid psql.Expression Processed psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -157,40 +161,41 @@ func (historyInspectionsampledetailColumns) AliasedAs(alias string) historyInspe // All values are optional, and do not have to be set // Generated columns are not included type HistoryInspectionsampledetailSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fadultact omitnull.Val[string] `db:"fadultact" ` - Fdomstage omitnull.Val[string] `db:"fdomstage" ` - Feggcount omitnull.Val[int16] `db:"feggcount" ` - Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` - Flarvcount omitnull.Val[int16] `db:"flarvcount" ` - Flstages omitnull.Val[string] `db:"flstages" ` - Fpupcount omitnull.Val[int16] `db:"fpupcount" ` - Globalid omitnull.Val[string] `db:"globalid" ` - InspsampleID omitnull.Val[string] `db:"inspsample_id" ` - Labspecies omitnull.Val[string] `db:"labspecies" ` - Ldomstage omitnull.Val[string] `db:"ldomstage" ` - Leggcount omitnull.Val[int16] `db:"leggcount" ` - Llarvcount omitnull.Val[int16] `db:"llarvcount" ` - Lpupcount omitnull.Val[int16] `db:"lpupcount" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fadultact omitnull.Val[string] `db:"fadultact" ` + Fdomstage omitnull.Val[string] `db:"fdomstage" ` + Feggcount omitnull.Val[int16] `db:"feggcount" ` + Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` + Flarvcount omitnull.Val[int16] `db:"flarvcount" ` + Flstages omitnull.Val[string] `db:"flstages" ` + Fpupcount omitnull.Val[int16] `db:"fpupcount" ` + Globalid omitnull.Val[string] `db:"globalid" ` + InspsampleID omitnull.Val[string] `db:"inspsample_id" ` + Labspecies omitnull.Val[string] `db:"labspecies" ` + Ldomstage omitnull.Val[string] `db:"ldomstage" ` + Leggcount omitnull.Val[int16] `db:"leggcount" ` + Llarvcount omitnull.Val[int16] `db:"llarvcount" ` + Lpupcount omitnull.Val[int16] `db:"lpupcount" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Processed omitnull.Val[int16] `db:"processed" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryInspectionsampledetailSetter) SetColumns() []string { - vals := make([]string, 0, 29) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 30) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Comments.IsUnset() { @@ -256,6 +261,9 @@ func (s HistoryInspectionsampledetailSetter) SetColumns() []string { if !s.Processed.IsUnset() { vals = append(vals, "processed") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -281,8 +289,8 @@ func (s HistoryInspectionsampledetailSetter) SetColumns() []string { } func (s HistoryInspectionsampledetailSetter) Overwrite(t *HistoryInspectionsampledetail) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Comments.IsUnset() { t.Comments = s.Comments.MustGetNull() @@ -347,6 +355,9 @@ func (s HistoryInspectionsampledetailSetter) Overwrite(t *HistoryInspectionsampl if !s.Processed.IsUnset() { t.Processed = s.Processed.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -376,9 +387,9 @@ func (s *HistoryInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 29) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 30) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -509,48 +520,54 @@ func (s *HistoryInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { vals[21] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[22] = psql.Arg(s.Created.MustGetNull()) } else { vals[22] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[23] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[23] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[24] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[24] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[24] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[25] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[25] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[25] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[26] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[26] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[27] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[27] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[28] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[28] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[28] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[29] = psql.Arg(s.Version.MustGet()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -560,9 +577,9 @@ func (s HistoryInspectionsampledetailSetter) UpdateMod() bob.Mod[*dialect.Update } func (s HistoryInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 29) + exprs := make([]bob.Expression, 0, 30) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -716,6 +733,13 @@ func (s HistoryInspectionsampledetailSetter) Expressions(prefix ...string) []bob }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1009,7 +1033,7 @@ func (o *HistoryInspectionsampledetail) Organization(mods ...bob.Mod[*dialect.Se } func (os HistoryInspectionsampledetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1027,7 +1051,7 @@ func (os HistoryInspectionsampledetailSlice) Organization(mods ...bob.Mod[*diale func attachHistoryInspectionsampledetailOrganization0(ctx context.Context, exec bob.Executor, count int, historyInspectionsampledetail0 *HistoryInspectionsampledetail, organization1 *Organization) (*HistoryInspectionsampledetail, error) { setter := &HistoryInspectionsampledetailSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyInspectionsampledetail0.Update(ctx, exec, setter) @@ -1074,7 +1098,7 @@ func (historyInspectionsampledetail0 *HistoryInspectionsampledetail) AttachOrgan } type historyInspectionsampledetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -1096,6 +1120,7 @@ type historyInspectionsampledetailWhere[Q psql.Filterable] struct { Lpupcount psql.WhereNullMod[Q, int16] Objectid psql.WhereMod[Q, int32] Processed psql.WhereNullMod[Q, int16] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1111,7 +1136,7 @@ func (historyInspectionsampledetailWhere[Q]) AliasedAs(alias string) historyInsp func buildHistoryInspectionsampledetailWhere[Q psql.Filterable](cols historyInspectionsampledetailColumns) historyInspectionsampledetailWhere[Q] { return historyInspectionsampledetailWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1133,6 +1158,7 @@ func buildHistoryInspectionsampledetailWhere[Q psql.Filterable](cols historyInsp Lpupcount: psql.WhereNull[Q, int16](cols.Lpupcount), Objectid: psql.Where[Q, int32](cols.Objectid), Processed: psql.WhereNull[Q, int16](cols.Processed), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1244,11 +1270,8 @@ func (os HistoryInspectionsampledetailSlice) LoadOrganization(ctx context.Contex } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_linelocation.bob.go b/models/history_linelocation.bob.go index e9bb8379..fd5b9d5a 100644 --- a/models/history_linelocation.bob.go +++ b/models/history_linelocation.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,58 +26,59 @@ import ( // HistoryLinelocation is an object representing the database table. type HistoryLinelocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Acres null.Val[float64] `db:"acres" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Hectares null.Val[float64] `db:"hectares" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - LengthFT null.Val[float64] `db:"length_ft" ` - LengthMeters null.Val[float64] `db:"length_meters" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Usetype null.Val[string] `db:"usetype" ` - Waterorigin null.Val[string] `db:"waterorigin" ` - WidthFT null.Val[float64] `db:"width_ft" ` - WidthMeters null.Val[float64] `db:"width_meters" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Accessdesc null.Val[string] `db:"accessdesc" ` + Acres null.Val[float64] `db:"acres" ` + Active null.Val[int16] `db:"active" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Description null.Val[string] `db:"description" ` + Externalid null.Val[string] `db:"externalid" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Habitat null.Val[string] `db:"habitat" ` + Hectares null.Val[float64] `db:"hectares" ` + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` + Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` + Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` + Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` + Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` + Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` + Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` + Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` + Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` + Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` + Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` + Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` + Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` + Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` + Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` + LengthFT null.Val[float64] `db:"length_ft" ` + LengthMeters null.Val[float64] `db:"length_meters" ` + Locationnumber null.Val[int64] `db:"locationnumber" ` + Name null.Val[string] `db:"name" ` + Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` + Objectid int32 `db:"objectid,pk" ` + Priority null.Val[string] `db:"priority" ` + Symbology null.Val[string] `db:"symbology" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Usetype null.Val[string] `db:"usetype" ` + Waterorigin null.Val[string] `db:"waterorigin" ` + WidthFT null.Val[float64] `db:"width_ft" ` + WidthMeters null.Val[float64] `db:"width_meters" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyLinelocationR `db:"-" ` } @@ -99,7 +101,7 @@ type historyLinelocationR struct { func buildHistoryLinelocationColumns(alias string) historyLinelocationColumns { return historyLinelocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "length_ft", "length_meters", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__length", "usetype", "waterorigin", "width_ft", "width_meters", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "length_ft", "length_meters", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__length", "usetype", "waterorigin", "width_ft", "width_meters", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_linelocation"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -147,6 +149,7 @@ func buildHistoryLinelocationColumns(alias string) historyLinelocationColumns { WidthMeters: psql.Quote(alias, "width_meters"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -205,6 +208,7 @@ type historyLinelocationColumns struct { WidthMeters psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -226,63 +230,64 @@ func (historyLinelocationColumns) AliasedAs(alias string) historyLinelocationCol // All values are optional, and do not have to be set // Generated columns are not included type HistoryLinelocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Acres omitnull.Val[float64] `db:"acres" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - LengthFT omitnull.Val[float64] `db:"length_ft" ` - LengthMeters omitnull.Val[float64] `db:"length_meters" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Waterorigin omitnull.Val[string] `db:"waterorigin" ` - WidthFT omitnull.Val[float64] `db:"width_ft" ` - WidthMeters omitnull.Val[float64] `db:"width_meters" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Acres omitnull.Val[float64] `db:"acres" ` + Active omitnull.Val[int16] `db:"active" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Description omitnull.Val[string] `db:"description" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Hectares omitnull.Val[float64] `db:"hectares" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` + Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` + Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` + Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` + Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` + Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` + Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` + Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` + Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` + Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` + Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` + Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` + Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` + Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` + Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` + LengthFT omitnull.Val[float64] `db:"length_ft" ` + LengthMeters omitnull.Val[float64] `db:"length_meters" ` + Locationnumber omitnull.Val[int64] `db:"locationnumber" ` + Name omitnull.Val[string] `db:"name" ` + Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Priority omitnull.Val[string] `db:"priority" ` + Symbology omitnull.Val[string] `db:"symbology" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + WidthFT omitnull.Val[float64] `db:"width_ft" ` + WidthMeters omitnull.Val[float64] `db:"width_meters" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryLinelocationSetter) SetColumns() []string { - vals := make([]string, 0, 52) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 53) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -417,6 +422,9 @@ func (s HistoryLinelocationSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -442,8 +450,8 @@ func (s HistoryLinelocationSetter) SetColumns() []string { } func (s HistoryLinelocationSetter) Overwrite(t *HistoryLinelocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -577,6 +585,9 @@ func (s HistoryLinelocationSetter) Overwrite(t *HistoryLinelocation) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -606,9 +617,9 @@ func (s *HistoryLinelocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 52) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 53) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -877,48 +888,54 @@ func (s *HistoryLinelocationSetter) Apply(q *dialect.InsertQuery) { vals[44] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[45] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[45] = psql.Arg(s.Created.MustGetNull()) } else { vals[45] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[46] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[46] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[46] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[47] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[47] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[47] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[48] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[48] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[48] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[49] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[49] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[49] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[50] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[50] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[50] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[51] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[51] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[51] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[52] = psql.Arg(s.Version.MustGet()) + } else { + vals[52] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -928,9 +945,9 @@ func (s HistoryLinelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryLinelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 52) + exprs := make([]bob.Expression, 0, 53) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1245,6 +1262,13 @@ func (s HistoryLinelocationSetter) Expressions(prefix ...string) []bob.Expressio }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1538,7 +1562,7 @@ func (o *HistoryLinelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery] } func (os HistoryLinelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1556,7 +1580,7 @@ func (os HistoryLinelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQ func attachHistoryLinelocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyLinelocation0 *HistoryLinelocation, organization1 *Organization) (*HistoryLinelocation, error) { setter := &HistoryLinelocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyLinelocation0.Update(ctx, exec, setter) @@ -1603,7 +1627,7 @@ func (historyLinelocation0 *HistoryLinelocation) AttachOrganization(ctx context. } type historyLinelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Acres psql.WhereNullMod[Q, float64] Active psql.WhereNullMod[Q, int16] @@ -1648,6 +1672,7 @@ type historyLinelocationWhere[Q psql.Filterable] struct { WidthMeters psql.WhereNullMod[Q, float64] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1663,7 +1688,7 @@ func (historyLinelocationWhere[Q]) AliasedAs(alias string) historyLinelocationWh func buildHistoryLinelocationWhere[Q psql.Filterable](cols historyLinelocationColumns) historyLinelocationWhere[Q] { return historyLinelocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Acres: psql.WhereNull[Q, float64](cols.Acres), Active: psql.WhereNull[Q, int16](cols.Active), @@ -1708,6 +1733,7 @@ func buildHistoryLinelocationWhere[Q psql.Filterable](cols historyLinelocationCo WidthMeters: psql.WhereNull[Q, float64](cols.WidthMeters), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1819,11 +1845,8 @@ func (os HistoryLinelocationSlice) LoadOrganization(ctx context.Context, exec bo } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_locationtracking.bob.go b/models/history_locationtracking.bob.go index 4c22e097..e1f7580d 100644 --- a/models/history_locationtracking.bob.go +++ b/models/history_locationtracking.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,22 +26,23 @@ import ( // HistoryLocationtracking is an object representing the database table. type HistoryLocationtracking struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Accuracy null.Val[float64] `db:"accuracy" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Accuracy null.Val[float64] `db:"accuracy" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Globalid null.Val[string] `db:"globalid" ` + Objectid int32 `db:"objectid,pk" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyLocationtrackingR `db:"-" ` } @@ -63,7 +65,7 @@ type historyLocationtrackingR struct { func buildHistoryLocationtrackingColumns(alias string) historyLocationtrackingColumns { return historyLocationtrackingColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accuracy", "creationdate", "creator", "editdate", "editor", "fieldtech", "globalid", "objectid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "accuracy", "creationdate", "creator", "editdate", "editor", "fieldtech", "globalid", "objectid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_locationtracking"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -75,6 +77,7 @@ func buildHistoryLocationtrackingColumns(alias string) historyLocationtrackingCo Fieldtech: psql.Quote(alias, "fieldtech"), Globalid: psql.Quote(alias, "globalid"), Objectid: psql.Quote(alias, "objectid"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -97,6 +100,7 @@ type historyLocationtrackingColumns struct { Fieldtech psql.Expression Globalid psql.Expression Objectid psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -118,27 +122,28 @@ func (historyLocationtrackingColumns) AliasedAs(alias string) historyLocationtra // All values are optional, and do not have to be set // Generated columns are not included type HistoryLocationtrackingSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Accuracy omitnull.Val[float64] `db:"accuracy" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Accuracy omitnull.Val[float64] `db:"accuracy" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryLocationtrackingSetter) SetColumns() []string { - vals := make([]string, 0, 16) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 17) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accuracy.IsUnset() { @@ -165,6 +170,9 @@ func (s HistoryLocationtrackingSetter) SetColumns() []string { if s.Objectid.IsValue() { vals = append(vals, "objectid") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -190,8 +198,8 @@ func (s HistoryLocationtrackingSetter) SetColumns() []string { } func (s HistoryLocationtrackingSetter) Overwrite(t *HistoryLocationtracking) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accuracy.IsUnset() { t.Accuracy = s.Accuracy.MustGetNull() @@ -217,6 +225,9 @@ func (s HistoryLocationtrackingSetter) Overwrite(t *HistoryLocationtracking) { if s.Objectid.IsValue() { t.Objectid = s.Objectid.MustGet() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -246,9 +257,9 @@ func (s *HistoryLocationtrackingSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 16) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 17) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -301,48 +312,54 @@ func (s *HistoryLocationtrackingSetter) Apply(q *dialect.InsertQuery) { vals[8] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[9] = psql.Arg(s.Created.MustGetNull()) } else { vals[9] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[10] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[11] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[12] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[12] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[13] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[15] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[15] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[16] = psql.Arg(s.Version.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -352,9 +369,9 @@ func (s HistoryLocationtrackingSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s HistoryLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 16) + exprs := make([]bob.Expression, 0, 17) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -417,6 +434,13 @@ func (s HistoryLocationtrackingSetter) Expressions(prefix ...string) []bob.Expre }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -710,7 +734,7 @@ func (o *HistoryLocationtracking) Organization(mods ...bob.Mod[*dialect.SelectQu } func (os HistoryLocationtrackingSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -728,7 +752,7 @@ func (os HistoryLocationtrackingSlice) Organization(mods ...bob.Mod[*dialect.Sel func attachHistoryLocationtrackingOrganization0(ctx context.Context, exec bob.Executor, count int, historyLocationtracking0 *HistoryLocationtracking, organization1 *Organization) (*HistoryLocationtracking, error) { setter := &HistoryLocationtrackingSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyLocationtracking0.Update(ctx, exec, setter) @@ -775,7 +799,7 @@ func (historyLocationtracking0 *HistoryLocationtracking) AttachOrganization(ctx } type historyLocationtrackingWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accuracy psql.WhereNullMod[Q, float64] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -784,6 +808,7 @@ type historyLocationtrackingWhere[Q psql.Filterable] struct { Fieldtech psql.WhereNullMod[Q, string] Globalid psql.WhereNullMod[Q, string] Objectid psql.WhereMod[Q, int32] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -799,7 +824,7 @@ func (historyLocationtrackingWhere[Q]) AliasedAs(alias string) historyLocationtr func buildHistoryLocationtrackingWhere[Q psql.Filterable](cols historyLocationtrackingColumns) historyLocationtrackingWhere[Q] { return historyLocationtrackingWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accuracy: psql.WhereNull[Q, float64](cols.Accuracy), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -808,6 +833,7 @@ func buildHistoryLocationtrackingWhere[Q psql.Filterable](cols historyLocationtr Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), Globalid: psql.WhereNull[Q, string](cols.Globalid), Objectid: psql.Where[Q, int32](cols.Objectid), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -919,11 +945,8 @@ func (os HistoryLocationtrackingSlice) LoadOrganization(ctx context.Context, exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_mosquitoinspection.bob.go b/models/history_mosquitoinspection.bob.go index 480c004b..c661ffa8 100644 --- a/models/history_mosquitoinspection.bob.go +++ b/models/history_mosquitoinspection.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,67 +26,68 @@ import ( // HistoryMosquitoinspection is an object representing the database table. type HistoryMosquitoinspection struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Actiontaken null.Val[string] `db:"actiontaken" ` - Activity null.Val[string] `db:"activity" ` - Adultact null.Val[string] `db:"adultact" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Avglarvae null.Val[float64] `db:"avglarvae" ` - Avgpupae null.Val[float64] `db:"avgpupae" ` - Breeding null.Val[string] `db:"breeding" ` - Cbcount null.Val[int16] `db:"cbcount" ` - Comments null.Val[string] `db:"comments" ` - Containercount null.Val[int16] `db:"containercount" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Domstage null.Val[string] `db:"domstage" ` - Eggs null.Val[int16] `db:"eggs" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldspecies null.Val[string] `db:"fieldspecies" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvaepresent null.Val[int16] `db:"larvaepresent" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Lstages null.Val[string] `db:"lstages" ` - Numdips null.Val[int16] `db:"numdips" ` - Objectid int32 `db:"objectid,pk" ` - Personalcontact null.Val[int16] `db:"personalcontact" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Posdips null.Val[int16] `db:"posdips" ` - Positivecontainercount null.Val[int16] `db:"positivecontainercount" ` - Pupaepresent null.Val[int16] `db:"pupaepresent" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sdid null.Val[string] `db:"sdid" ` - Sitecond null.Val[string] `db:"sitecond" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Tirecount null.Val[int16] `db:"tirecount" ` - Totlarvae null.Val[int16] `db:"totlarvae" ` - Totpupae null.Val[int16] `db:"totpupae" ` - Visualmonitoring null.Val[int16] `db:"visualmonitoring" ` - Vmcomments null.Val[string] `db:"vmcomments" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Adminaction null.Val[string] `db:"adminaction" ` - Ptaid null.Val[string] `db:"ptaid" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Actiontaken null.Val[string] `db:"actiontaken" ` + Activity null.Val[string] `db:"activity" ` + Adultact null.Val[string] `db:"adultact" ` + Avetemp null.Val[float64] `db:"avetemp" ` + Avglarvae null.Val[float64] `db:"avglarvae" ` + Avgpupae null.Val[float64] `db:"avgpupae" ` + Breeding null.Val[string] `db:"breeding" ` + Cbcount null.Val[int16] `db:"cbcount" ` + Comments null.Val[string] `db:"comments" ` + Containercount null.Val[int16] `db:"containercount" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Domstage null.Val[string] `db:"domstage" ` + Eggs null.Val[int16] `db:"eggs" ` + Enddatetime null.Val[int64] `db:"enddatetime" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldspecies null.Val[string] `db:"fieldspecies" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Globalid null.Val[string] `db:"globalid" ` + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Larvaepresent null.Val[int16] `db:"larvaepresent" ` + Linelocid null.Val[string] `db:"linelocid" ` + Locationname null.Val[string] `db:"locationname" ` + Lstages null.Val[string] `db:"lstages" ` + Numdips null.Val[int16] `db:"numdips" ` + Objectid int32 `db:"objectid,pk" ` + Personalcontact null.Val[int16] `db:"personalcontact" ` + Pointlocid null.Val[string] `db:"pointlocid" ` + Polygonlocid null.Val[string] `db:"polygonlocid" ` + Posdips null.Val[int16] `db:"posdips" ` + Positivecontainercount null.Val[int16] `db:"positivecontainercount" ` + Pupaepresent null.Val[int16] `db:"pupaepresent" ` + Raingauge null.Val[float64] `db:"raingauge" ` + Recordstatus null.Val[int16] `db:"recordstatus" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + Sdid null.Val[string] `db:"sdid" ` + Sitecond null.Val[string] `db:"sitecond" ` + Srid null.Val[string] `db:"srid" ` + Startdatetime null.Val[int64] `db:"startdatetime" ` + Tirecount null.Val[int16] `db:"tirecount" ` + Totlarvae null.Val[int16] `db:"totlarvae" ` + Totpupae null.Val[int16] `db:"totpupae" ` + Visualmonitoring null.Val[int16] `db:"visualmonitoring" ` + Vmcomments null.Val[string] `db:"vmcomments" ` + Winddir null.Val[string] `db:"winddir" ` + Windspeed null.Val[float64] `db:"windspeed" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Adminaction null.Val[string] `db:"adminaction" ` + Ptaid null.Val[string] `db:"ptaid" ` + Version int32 `db:"version,pk" ` R historyMosquitoinspectionR `db:"-" ` } @@ -108,7 +110,7 @@ type historyMosquitoinspectionR struct { func buildHistoryMosquitoinspectionColumns(alias string) historyMosquitoinspectionColumns { return historyMosquitoinspectionColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "actiontaken", "activity", "adultact", "avetemp", "avglarvae", "avgpupae", "breeding", "cbcount", "comments", "containercount", "creationdate", "creator", "domstage", "eggs", "enddatetime", "editdate", "editor", "fieldspecies", "fieldtech", "globalid", "jurisdiction", "larvaepresent", "linelocid", "locationname", "lstages", "numdips", "objectid", "personalcontact", "pointlocid", "polygonlocid", "posdips", "positivecontainercount", "pupaepresent", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "tirecount", "totlarvae", "totpupae", "visualmonitoring", "vmcomments", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "adminaction", "ptaid", "version", + "organization_id", "actiontaken", "activity", "adultact", "avetemp", "avglarvae", "avgpupae", "breeding", "cbcount", "comments", "containercount", "creationdate", "creator", "domstage", "eggs", "enddatetime", "editdate", "editor", "fieldspecies", "fieldtech", "globalid", "jurisdiction", "larvaepresent", "linelocid", "locationname", "lstages", "numdips", "objectid", "personalcontact", "pointlocid", "polygonlocid", "posdips", "positivecontainercount", "pupaepresent", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "tirecount", "totlarvae", "totpupae", "visualmonitoring", "vmcomments", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "adminaction", "ptaid", "version", ).WithParent("history_mosquitoinspection"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -163,6 +165,7 @@ func buildHistoryMosquitoinspectionColumns(alias string) historyMosquitoinspecti Windspeed: psql.Quote(alias, "windspeed"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -230,6 +233,7 @@ type historyMosquitoinspectionColumns struct { Windspeed psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -253,72 +257,73 @@ func (historyMosquitoinspectionColumns) AliasedAs(alias string) historyMosquitoi // All values are optional, and do not have to be set // Generated columns are not included type HistoryMosquitoinspectionSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Actiontaken omitnull.Val[string] `db:"actiontaken" ` - Activity omitnull.Val[string] `db:"activity" ` - Adultact omitnull.Val[string] `db:"adultact" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Avglarvae omitnull.Val[float64] `db:"avglarvae" ` - Avgpupae omitnull.Val[float64] `db:"avgpupae" ` - Breeding omitnull.Val[string] `db:"breeding" ` - Cbcount omitnull.Val[int16] `db:"cbcount" ` - Comments omitnull.Val[string] `db:"comments" ` - Containercount omitnull.Val[int16] `db:"containercount" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Domstage omitnull.Val[string] `db:"domstage" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Lstages omitnull.Val[string] `db:"lstages" ` - Numdips omitnull.Val[int16] `db:"numdips" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Personalcontact omitnull.Val[int16] `db:"personalcontact" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Positivecontainercount omitnull.Val[int16] `db:"positivecontainercount" ` - Pupaepresent omitnull.Val[int16] `db:"pupaepresent" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sdid omitnull.Val[string] `db:"sdid" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Tirecount omitnull.Val[int16] `db:"tirecount" ` - Totlarvae omitnull.Val[int16] `db:"totlarvae" ` - Totpupae omitnull.Val[int16] `db:"totpupae" ` - Visualmonitoring omitnull.Val[int16] `db:"visualmonitoring" ` - Vmcomments omitnull.Val[string] `db:"vmcomments" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Adminaction omitnull.Val[string] `db:"adminaction" ` - Ptaid omitnull.Val[string] `db:"ptaid" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Actiontaken omitnull.Val[string] `db:"actiontaken" ` + Activity omitnull.Val[string] `db:"activity" ` + Adultact omitnull.Val[string] `db:"adultact" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Avglarvae omitnull.Val[float64] `db:"avglarvae" ` + Avgpupae omitnull.Val[float64] `db:"avgpupae" ` + Breeding omitnull.Val[string] `db:"breeding" ` + Cbcount omitnull.Val[int16] `db:"cbcount" ` + Comments omitnull.Val[string] `db:"comments" ` + Containercount omitnull.Val[int16] `db:"containercount" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Domstage omitnull.Val[string] `db:"domstage" ` + Eggs omitnull.Val[int16] `db:"eggs" ` + Enddatetime omitnull.Val[int64] `db:"enddatetime" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` + Linelocid omitnull.Val[string] `db:"linelocid" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Lstages omitnull.Val[string] `db:"lstages" ` + Numdips omitnull.Val[int16] `db:"numdips" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Personalcontact omitnull.Val[int16] `db:"personalcontact" ` + Pointlocid omitnull.Val[string] `db:"pointlocid" ` + Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` + Posdips omitnull.Val[int16] `db:"posdips" ` + Positivecontainercount omitnull.Val[int16] `db:"positivecontainercount" ` + Pupaepresent omitnull.Val[int16] `db:"pupaepresent" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + Sdid omitnull.Val[string] `db:"sdid" ` + Sitecond omitnull.Val[string] `db:"sitecond" ` + Srid omitnull.Val[string] `db:"srid" ` + Startdatetime omitnull.Val[int64] `db:"startdatetime" ` + Tirecount omitnull.Val[int16] `db:"tirecount" ` + Totlarvae omitnull.Val[int16] `db:"totlarvae" ` + Totpupae omitnull.Val[int16] `db:"totpupae" ` + Visualmonitoring omitnull.Val[int16] `db:"visualmonitoring" ` + Vmcomments omitnull.Val[string] `db:"vmcomments" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Adminaction omitnull.Val[string] `db:"adminaction" ` + Ptaid omitnull.Val[string] `db:"ptaid" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryMosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 61) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 62) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Actiontaken.IsUnset() { @@ -474,6 +479,9 @@ func (s HistoryMosquitoinspectionSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -505,8 +513,8 @@ func (s HistoryMosquitoinspectionSetter) SetColumns() []string { } func (s HistoryMosquitoinspectionSetter) Overwrite(t *HistoryMosquitoinspection) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Actiontaken.IsUnset() { t.Actiontaken = s.Actiontaken.MustGetNull() @@ -661,6 +669,9 @@ func (s HistoryMosquitoinspectionSetter) Overwrite(t *HistoryMosquitoinspection) if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -696,9 +707,9 @@ func (s *HistoryMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 61) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 62) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1009,60 +1020,66 @@ func (s *HistoryMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { vals[51] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[52] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[52] = psql.Arg(s.Created.MustGetNull()) } else { vals[52] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[53] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[53] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[53] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[54] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[54] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[54] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[55] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[55] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[55] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[56] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[56] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[56] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[57] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[57] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[57] = psql.Raw("DEFAULT") } - if !s.Adminaction.IsUnset() { - vals[58] = psql.Arg(s.Adminaction.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[58] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[58] = psql.Raw("DEFAULT") } - if !s.Ptaid.IsUnset() { - vals[59] = psql.Arg(s.Ptaid.MustGetNull()) + if !s.Adminaction.IsUnset() { + vals[59] = psql.Arg(s.Adminaction.MustGetNull()) } else { vals[59] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[60] = psql.Arg(s.Version.MustGet()) + if !s.Ptaid.IsUnset() { + vals[60] = psql.Arg(s.Ptaid.MustGetNull()) } else { vals[60] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[61] = psql.Arg(s.Version.MustGet()) + } else { + vals[61] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -1072,9 +1089,9 @@ func (s HistoryMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuer } func (s HistoryMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 61) + exprs := make([]bob.Expression, 0, 62) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1438,6 +1455,13 @@ func (s HistoryMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Exp }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1745,7 +1769,7 @@ func (o *HistoryMosquitoinspection) Organization(mods ...bob.Mod[*dialect.Select } func (os HistoryMosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1763,7 +1787,7 @@ func (os HistoryMosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.S func attachHistoryMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyMosquitoinspection0 *HistoryMosquitoinspection, organization1 *Organization) (*HistoryMosquitoinspection, error) { setter := &HistoryMosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyMosquitoinspection0.Update(ctx, exec, setter) @@ -1810,7 +1834,7 @@ func (historyMosquitoinspection0 *HistoryMosquitoinspection) AttachOrganization( } type historyMosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Actiontaken psql.WhereNullMod[Q, string] Activity psql.WhereNullMod[Q, string] Adultact psql.WhereNullMod[Q, string] @@ -1862,6 +1886,7 @@ type historyMosquitoinspectionWhere[Q psql.Filterable] struct { Windspeed psql.WhereNullMod[Q, float64] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1879,7 +1904,7 @@ func (historyMosquitoinspectionWhere[Q]) AliasedAs(alias string) historyMosquito func buildHistoryMosquitoinspectionWhere[Q psql.Filterable](cols historyMosquitoinspectionColumns) historyMosquitoinspectionWhere[Q] { return historyMosquitoinspectionWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), Activity: psql.WhereNull[Q, string](cols.Activity), Adultact: psql.WhereNull[Q, string](cols.Adultact), @@ -1931,6 +1956,7 @@ func buildHistoryMosquitoinspectionWhere[Q psql.Filterable](cols historyMosquito Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -2044,11 +2070,8 @@ func (os HistoryMosquitoinspectionSlice) LoadOrganization(ctx context.Context, e } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_pointlocation.bob.go b/models/history_pointlocation.bob.go index f51dfec8..f709c1c7 100644 --- a/models/history_pointlocation.bob.go +++ b/models/history_pointlocation.bob.go @@ -25,7 +25,7 @@ import ( // HistoryPointlocation is an object representing the database table. type HistoryPointlocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Active null.Val[int16] `db:"active" ` Comments null.Val[string] `db:"comments" ` @@ -214,7 +214,7 @@ func (historyPointlocationColumns) AliasedAs(alias string) historyPointlocationC // All values are optional, and do not have to be set // Generated columns are not included type HistoryPointlocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Active omitnull.Val[int16] `db:"active" ` Comments omitnull.Val[string] `db:"comments" ` @@ -266,7 +266,7 @@ type HistoryPointlocationSetter struct { func (s HistoryPointlocationSetter) SetColumns() []string { vals := make([]string, 0, 48) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -414,8 +414,8 @@ func (s HistoryPointlocationSetter) SetColumns() []string { } func (s HistoryPointlocationSetter) Overwrite(t *HistoryPointlocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -567,8 +567,8 @@ func (s *HistoryPointlocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 48) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -866,7 +866,7 @@ func (s HistoryPointlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s HistoryPointlocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 48) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1446,7 +1446,7 @@ func (o *HistoryPointlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery } func (os HistoryPointlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1464,7 +1464,7 @@ func (os HistoryPointlocationSlice) Organization(mods ...bob.Mod[*dialect.Select func attachHistoryPointlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyPointlocation0 *HistoryPointlocation, organization1 *Organization) (*HistoryPointlocation, error) { setter := &HistoryPointlocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyPointlocation0.Update(ctx, exec, setter) @@ -1511,7 +1511,7 @@ func (historyPointlocation0 *HistoryPointlocation) AttachOrganization(ctx contex } type historyPointlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1567,7 +1567,7 @@ func (historyPointlocationWhere[Q]) AliasedAs(alias string) historyPointlocation func buildHistoryPointlocationWhere[Q psql.Filterable](cols historyPointlocationColumns) historyPointlocationWhere[Q] { return historyPointlocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1719,11 +1719,8 @@ func (os HistoryPointlocationSlice) LoadOrganization(ctx context.Context, exec b } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_polygonlocation.bob.go b/models/history_polygonlocation.bob.go index af16ea4f..f4327170 100644 --- a/models/history_polygonlocation.bob.go +++ b/models/history_polygonlocation.bob.go @@ -25,7 +25,7 @@ import ( // HistoryPolygonlocation is an object representing the database table. type HistoryPolygonlocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Accessdesc null.Val[string] `db:"accessdesc" ` Acres null.Val[float64] `db:"acres" ` Active null.Val[int16] `db:"active" ` @@ -208,7 +208,7 @@ func (historyPolygonlocationColumns) AliasedAs(alias string) historyPolygonlocat // All values are optional, and do not have to be set // Generated columns are not included type HistoryPolygonlocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Accessdesc omitnull.Val[string] `db:"accessdesc" ` Acres omitnull.Val[float64] `db:"acres" ` Active omitnull.Val[int16] `db:"active" ` @@ -258,7 +258,7 @@ type HistoryPolygonlocationSetter struct { func (s HistoryPolygonlocationSetter) SetColumns() []string { vals := make([]string, 0, 46) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -400,8 +400,8 @@ func (s HistoryPolygonlocationSetter) SetColumns() []string { } func (s HistoryPolygonlocationSetter) Overwrite(t *HistoryPolygonlocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -547,8 +547,8 @@ func (s *HistoryPolygonlocationSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 46) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -834,7 +834,7 @@ func (s HistoryPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] func (s HistoryPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 46) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1400,7 +1400,7 @@ func (o *HistoryPolygonlocation) Organization(mods ...bob.Mod[*dialect.SelectQue } func (os HistoryPolygonlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1418,7 +1418,7 @@ func (os HistoryPolygonlocationSlice) Organization(mods ...bob.Mod[*dialect.Sele func attachHistoryPolygonlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyPolygonlocation0 *HistoryPolygonlocation, organization1 *Organization) (*HistoryPolygonlocation, error) { setter := &HistoryPolygonlocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyPolygonlocation0.Update(ctx, exec, setter) @@ -1465,7 +1465,7 @@ func (historyPolygonlocation0 *HistoryPolygonlocation) AttachOrganization(ctx co } type historyPolygonlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Acres psql.WhereNullMod[Q, float64] Active psql.WhereNullMod[Q, int16] @@ -1519,7 +1519,7 @@ func (historyPolygonlocationWhere[Q]) AliasedAs(alias string) historyPolygonloca func buildHistoryPolygonlocationWhere[Q psql.Filterable](cols historyPolygonlocationColumns) historyPolygonlocationWhere[Q] { return historyPolygonlocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Acres: psql.WhereNull[Q, float64](cols.Acres), Active: psql.WhereNull[Q, int16](cols.Active), @@ -1669,11 +1669,8 @@ func (os HistoryPolygonlocationSlice) LoadOrganization(ctx context.Context, exec } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_pool.bob.go b/models/history_pool.bob.go index 00cf9d0a..23279e00 100644 --- a/models/history_pool.bob.go +++ b/models/history_pool.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,38 +26,39 @@ import ( // HistoryPool is an object representing the database table. type HistoryPool struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datesent null.Val[int64] `db:"datesent" ` - Datetested null.Val[int64] `db:"datetested" ` - Diseasepos null.Val[string] `db:"diseasepos" ` - Diseasetested null.Val[string] `db:"diseasetested" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Lab null.Val[string] `db:"lab" ` - LabID null.Val[string] `db:"lab_id" ` - Objectid int32 `db:"objectid,pk" ` - Poolyear null.Val[int16] `db:"poolyear" ` - Processed null.Val[int16] `db:"processed" ` - Sampleid null.Val[string] `db:"sampleid" ` - Survtech null.Val[string] `db:"survtech" ` - Testmethod null.Val[string] `db:"testmethod" ` - Testtech null.Val[string] `db:"testtech" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Vectorsurvcollectionid null.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid null.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Datesent null.Val[int64] `db:"datesent" ` + Datetested null.Val[int64] `db:"datetested" ` + Diseasepos null.Val[string] `db:"diseasepos" ` + Diseasetested null.Val[string] `db:"diseasetested" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + Globalid null.Val[string] `db:"globalid" ` + Lab null.Val[string] `db:"lab" ` + LabID null.Val[string] `db:"lab_id" ` + Objectid int32 `db:"objectid,pk" ` + Poolyear null.Val[int16] `db:"poolyear" ` + Processed null.Val[int16] `db:"processed" ` + Sampleid null.Val[string] `db:"sampleid" ` + Survtech null.Val[string] `db:"survtech" ` + Testmethod null.Val[string] `db:"testmethod" ` + Testtech null.Val[string] `db:"testtech" ` + TrapdataID null.Val[string] `db:"trapdata_id" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Vectorsurvcollectionid null.Val[string] `db:"vectorsurvcollectionid" ` + Vectorsurvpoolid null.Val[string] `db:"vectorsurvpoolid" ` + Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` + Version int32 `db:"version,pk" ` R historyPoolR `db:"-" ` } @@ -79,7 +81,7 @@ type historyPoolR struct { func buildHistoryPoolColumns(alias string) historyPoolColumns { return historyPoolColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "editdate", "editor", "gatewaysync", "globalid", "lab", "lab_id", "objectid", "poolyear", "processed", "sampleid", "survtech", "testmethod", "testtech", "trapdata_id", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "vectorsurvcollectionid", "vectorsurvpoolid", "vectorsurvtrapdataid", "version", + "organization_id", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "editdate", "editor", "gatewaysync", "globalid", "lab", "lab_id", "objectid", "poolyear", "processed", "sampleid", "survtech", "testmethod", "testtech", "trapdata_id", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "vectorsurvcollectionid", "vectorsurvpoolid", "vectorsurvtrapdataid", "version", ).WithParent("history_pool"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -104,6 +106,7 @@ func buildHistoryPoolColumns(alias string) historyPoolColumns { Testmethod: psql.Quote(alias, "testmethod"), Testtech: psql.Quote(alias, "testtech"), TrapdataID: psql.Quote(alias, "trapdata_id"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -142,6 +145,7 @@ type historyPoolColumns struct { Testmethod psql.Expression Testtech psql.Expression TrapdataID psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -166,43 +170,44 @@ func (historyPoolColumns) AliasedAs(alias string) historyPoolColumns { // All values are optional, and do not have to be set // Generated columns are not included type HistoryPoolSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datesent omitnull.Val[int64] `db:"datesent" ` - Datetested omitnull.Val[int64] `db:"datetested" ` - Diseasepos omitnull.Val[string] `db:"diseasepos" ` - Diseasetested omitnull.Val[string] `db:"diseasetested" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Lab omitnull.Val[string] `db:"lab" ` - LabID omitnull.Val[string] `db:"lab_id" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Poolyear omitnull.Val[int16] `db:"poolyear" ` - Processed omitnull.Val[int16] `db:"processed" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Testmethod omitnull.Val[string] `db:"testmethod" ` - Testtech omitnull.Val[string] `db:"testtech" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Vectorsurvcollectionid omitnull.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid omitnull.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Datesent omitnull.Val[int64] `db:"datesent" ` + Datetested omitnull.Val[int64] `db:"datetested" ` + Diseasepos omitnull.Val[string] `db:"diseasepos" ` + Diseasetested omitnull.Val[string] `db:"diseasetested" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Lab omitnull.Val[string] `db:"lab" ` + LabID omitnull.Val[string] `db:"lab_id" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Poolyear omitnull.Val[int16] `db:"poolyear" ` + Processed omitnull.Val[int16] `db:"processed" ` + Sampleid omitnull.Val[string] `db:"sampleid" ` + Survtech omitnull.Val[string] `db:"survtech" ` + Testmethod omitnull.Val[string] `db:"testmethod" ` + Testtech omitnull.Val[string] `db:"testtech" ` + TrapdataID omitnull.Val[string] `db:"trapdata_id" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Vectorsurvcollectionid omitnull.Val[string] `db:"vectorsurvcollectionid" ` + Vectorsurvpoolid omitnull.Val[string] `db:"vectorsurvpoolid" ` + Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryPoolSetter) SetColumns() []string { - vals := make([]string, 0, 32) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 33) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Comments.IsUnset() { @@ -268,6 +273,9 @@ func (s HistoryPoolSetter) SetColumns() []string { if !s.TrapdataID.IsUnset() { vals = append(vals, "trapdata_id") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -302,8 +310,8 @@ func (s HistoryPoolSetter) SetColumns() []string { } func (s HistoryPoolSetter) Overwrite(t *HistoryPool) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Comments.IsUnset() { t.Comments = s.Comments.MustGetNull() @@ -368,6 +376,9 @@ func (s HistoryPoolSetter) Overwrite(t *HistoryPool) { if !s.TrapdataID.IsUnset() { t.TrapdataID = s.TrapdataID.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -406,9 +417,9 @@ func (s *HistoryPoolSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 32) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 33) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -539,66 +550,72 @@ func (s *HistoryPoolSetter) Apply(q *dialect.InsertQuery) { vals[21] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[22] = psql.Arg(s.Created.MustGetNull()) } else { vals[22] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[23] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[23] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[24] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[24] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[24] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[25] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[25] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[25] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[26] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[26] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[27] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[27] = psql.Raw("DEFAULT") } - if !s.Vectorsurvcollectionid.IsUnset() { - vals[28] = psql.Arg(s.Vectorsurvcollectionid.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[28] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[28] = psql.Raw("DEFAULT") } - if !s.Vectorsurvpoolid.IsUnset() { - vals[29] = psql.Arg(s.Vectorsurvpoolid.MustGetNull()) + if !s.Vectorsurvcollectionid.IsUnset() { + vals[29] = psql.Arg(s.Vectorsurvcollectionid.MustGetNull()) } else { vals[29] = psql.Raw("DEFAULT") } - if !s.Vectorsurvtrapdataid.IsUnset() { - vals[30] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) + if !s.Vectorsurvpoolid.IsUnset() { + vals[30] = psql.Arg(s.Vectorsurvpoolid.MustGetNull()) } else { vals[30] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[31] = psql.Arg(s.Version.MustGet()) + if !s.Vectorsurvtrapdataid.IsUnset() { + vals[31] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) } else { vals[31] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[32] = psql.Arg(s.Version.MustGet()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -608,9 +625,9 @@ func (s HistoryPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryPoolSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 32) + exprs := make([]bob.Expression, 0, 33) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -764,6 +781,13 @@ func (s HistoryPoolSetter) Expressions(prefix ...string) []bob.Expression { }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1078,7 +1102,7 @@ func (o *HistoryPool) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organi } func (os HistoryPoolSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1096,7 +1120,7 @@ func (os HistoryPoolSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O func attachHistoryPoolOrganization0(ctx context.Context, exec bob.Executor, count int, historyPool0 *HistoryPool, organization1 *Organization) (*HistoryPool, error) { setter := &HistoryPoolSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyPool0.Update(ctx, exec, setter) @@ -1143,7 +1167,7 @@ func (historyPool0 *HistoryPool) AttachOrganization(ctx context.Context, exec bo } type historyPoolWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -1165,6 +1189,7 @@ type historyPoolWhere[Q psql.Filterable] struct { Testmethod psql.WhereNullMod[Q, string] Testtech psql.WhereNullMod[Q, string] TrapdataID psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1183,7 +1208,7 @@ func (historyPoolWhere[Q]) AliasedAs(alias string) historyPoolWhere[Q] { func buildHistoryPoolWhere[Q psql.Filterable](cols historyPoolColumns) historyPoolWhere[Q] { return historyPoolWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1205,6 +1230,7 @@ func buildHistoryPoolWhere[Q psql.Filterable](cols historyPoolColumns) historyPo Testmethod: psql.WhereNull[Q, string](cols.Testmethod), Testtech: psql.WhereNull[Q, string](cols.Testtech), TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1319,11 +1345,8 @@ func (os HistoryPoolSlice) LoadOrganization(ctx context.Context, exec bob.Execut } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_pooldetail.bob.go b/models/history_pooldetail.bob.go index b5357aae..b3f87e5a 100644 --- a/models/history_pooldetail.bob.go +++ b/models/history_pooldetail.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,24 +26,25 @@ import ( // HistoryPooldetail is an object representing the database table. type HistoryPooldetail struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Females null.Val[int16] `db:"females" ` - Globalid null.Val[string] `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - PoolID null.Val[string] `db:"pool_id" ` - Species null.Val[string] `db:"species" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Females null.Val[int16] `db:"females" ` + Globalid null.Val[string] `db:"globalid" ` + Objectid int32 `db:"objectid,pk" ` + PoolID null.Val[string] `db:"pool_id" ` + Species null.Val[string] `db:"species" ` + TrapdataID null.Val[string] `db:"trapdata_id" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyPooldetailR `db:"-" ` } @@ -65,7 +67,7 @@ type historyPooldetailR struct { func buildHistoryPooldetailColumns(alias string) historyPooldetailColumns { return historyPooldetailColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "females", "globalid", "objectid", "pool_id", "species", "trapdata_id", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "creationdate", "creator", "editdate", "editor", "females", "globalid", "objectid", "pool_id", "species", "trapdata_id", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_pooldetail"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -79,6 +81,7 @@ func buildHistoryPooldetailColumns(alias string) historyPooldetailColumns { PoolID: psql.Quote(alias, "pool_id"), Species: psql.Quote(alias, "species"), TrapdataID: psql.Quote(alias, "trapdata_id"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -103,6 +106,7 @@ type historyPooldetailColumns struct { PoolID psql.Expression Species psql.Expression TrapdataID psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -124,29 +128,30 @@ func (historyPooldetailColumns) AliasedAs(alias string) historyPooldetailColumns // All values are optional, and do not have to be set // Generated columns are not included type HistoryPooldetailSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Females omitnull.Val[int16] `db:"females" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - PoolID omitnull.Val[string] `db:"pool_id" ` - Species omitnull.Val[string] `db:"species" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Females omitnull.Val[int16] `db:"females" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + PoolID omitnull.Val[string] `db:"pool_id" ` + Species omitnull.Val[string] `db:"species" ` + TrapdataID omitnull.Val[string] `db:"trapdata_id" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryPooldetailSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 19) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -179,6 +184,9 @@ func (s HistoryPooldetailSetter) SetColumns() []string { if !s.TrapdataID.IsUnset() { vals = append(vals, "trapdata_id") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -204,8 +212,8 @@ func (s HistoryPooldetailSetter) SetColumns() []string { } func (s HistoryPooldetailSetter) Overwrite(t *HistoryPooldetail) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -237,6 +245,9 @@ func (s HistoryPooldetailSetter) Overwrite(t *HistoryPooldetail) { if !s.TrapdataID.IsUnset() { t.TrapdataID = s.TrapdataID.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -266,9 +277,9 @@ func (s *HistoryPooldetailSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 19) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -333,48 +344,54 @@ func (s *HistoryPooldetailSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[11] = psql.Arg(s.Created.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[14] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[15] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[17] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[17] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[18] = psql.Arg(s.Version.MustGet()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -384,9 +401,9 @@ func (s HistoryPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryPooldetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) + exprs := make([]bob.Expression, 0, 19) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -463,6 +480,13 @@ func (s HistoryPooldetailSetter) Expressions(prefix ...string) []bob.Expression }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -756,7 +780,7 @@ func (o *HistoryPooldetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os HistoryPooldetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -774,7 +798,7 @@ func (os HistoryPooldetailSlice) Organization(mods ...bob.Mod[*dialect.SelectQue func attachHistoryPooldetailOrganization0(ctx context.Context, exec bob.Executor, count int, historyPooldetail0 *HistoryPooldetail, organization1 *Organization) (*HistoryPooldetail, error) { setter := &HistoryPooldetailSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyPooldetail0.Update(ctx, exec, setter) @@ -821,7 +845,7 @@ func (historyPooldetail0 *HistoryPooldetail) AttachOrganization(ctx context.Cont } type historyPooldetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -832,6 +856,7 @@ type historyPooldetailWhere[Q psql.Filterable] struct { PoolID psql.WhereNullMod[Q, string] Species psql.WhereNullMod[Q, string] TrapdataID psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -847,7 +872,7 @@ func (historyPooldetailWhere[Q]) AliasedAs(alias string) historyPooldetailWhere[ func buildHistoryPooldetailWhere[Q psql.Filterable](cols historyPooldetailColumns) historyPooldetailWhere[Q] { return historyPooldetailWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -858,6 +883,7 @@ func buildHistoryPooldetailWhere[Q psql.Filterable](cols historyPooldetailColumn PoolID: psql.WhereNull[Q, string](cols.PoolID), Species: psql.WhereNull[Q, string](cols.Species), TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -969,11 +995,8 @@ func (os HistoryPooldetailSlice) LoadOrganization(ctx context.Context, exec bob. } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_proposedtreatmentarea.bob.go b/models/history_proposedtreatmentarea.bob.go index 7dc6c55a..a9f00da1 100644 --- a/models/history_proposedtreatmentarea.bob.go +++ b/models/history_proposedtreatmentarea.bob.go @@ -25,7 +25,7 @@ import ( // HistoryProposedtreatmentarea is an object representing the database table. type HistoryProposedtreatmentarea struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Acres null.Val[float64] `db:"acres" ` Comments null.Val[string] `db:"comments" ` Completed null.Val[int16] `db:"completed" ` @@ -181,7 +181,7 @@ func (historyProposedtreatmentareaColumns) AliasedAs(alias string) historyPropos // All values are optional, and do not have to be set // Generated columns are not included type HistoryProposedtreatmentareaSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Acres omitnull.Val[float64] `db:"acres" ` Comments omitnull.Val[string] `db:"comments" ` Completed omitnull.Val[int16] `db:"completed" ` @@ -222,7 +222,7 @@ type HistoryProposedtreatmentareaSetter struct { func (s HistoryProposedtreatmentareaSetter) SetColumns() []string { vals := make([]string, 0, 37) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Acres.IsUnset() { @@ -337,8 +337,8 @@ func (s HistoryProposedtreatmentareaSetter) SetColumns() []string { } func (s HistoryProposedtreatmentareaSetter) Overwrite(t *HistoryProposedtreatmentarea) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Acres.IsUnset() { t.Acres = s.Acres.MustGetNull() @@ -457,8 +457,8 @@ func (s *HistoryProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 37) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -690,7 +690,7 @@ func (s HistoryProposedtreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQ func (s HistoryProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 37) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1193,7 +1193,7 @@ func (o *HistoryProposedtreatmentarea) Organization(mods ...bob.Mod[*dialect.Sel } func (os HistoryProposedtreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1211,7 +1211,7 @@ func (os HistoryProposedtreatmentareaSlice) Organization(mods ...bob.Mod[*dialec func attachHistoryProposedtreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, historyProposedtreatmentarea0 *HistoryProposedtreatmentarea, organization1 *Organization) (*HistoryProposedtreatmentarea, error) { setter := &HistoryProposedtreatmentareaSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyProposedtreatmentarea0.Update(ctx, exec, setter) @@ -1258,7 +1258,7 @@ func (historyProposedtreatmentarea0 *HistoryProposedtreatmentarea) AttachOrganiz } type historyProposedtreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Acres psql.WhereNullMod[Q, float64] Comments psql.WhereNullMod[Q, string] Completed psql.WhereNullMod[Q, int16] @@ -1303,7 +1303,7 @@ func (historyProposedtreatmentareaWhere[Q]) AliasedAs(alias string) historyPropo func buildHistoryProposedtreatmentareaWhere[Q psql.Filterable](cols historyProposedtreatmentareaColumns) historyProposedtreatmentareaWhere[Q] { return historyProposedtreatmentareaWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Acres: psql.WhereNull[Q, float64](cols.Acres), Comments: psql.WhereNull[Q, string](cols.Comments), Completed: psql.WhereNull[Q, int16](cols.Completed), @@ -1444,11 +1444,8 @@ func (os HistoryProposedtreatmentareaSlice) LoadOrganization(ctx context.Context } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_qamosquitoinspection.bob.go b/models/history_qamosquitoinspection.bob.go index 0128ac5c..c9e05033 100644 --- a/models/history_qamosquitoinspection.bob.go +++ b/models/history_qamosquitoinspection.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,72 +26,73 @@ import ( // HistoryQamosquitoinspection is an object representing the database table. type HistoryQamosquitoinspection struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Acresbreeding null.Val[float64] `db:"acresbreeding" ` - Actiontaken null.Val[string] `db:"actiontaken" ` - Adultactivity null.Val[int16] `db:"adultactivity" ` - Aquaticorganisms null.Val[string] `db:"aquaticorganisms" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Breedingpotential null.Val[string] `db:"breedingpotential" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Fish null.Val[int16] `db:"fish" ` - Globalid null.Val[string] `db:"globalid" ` - Habvalue1 null.Val[int16] `db:"habvalue1" ` - Habvalue1percent null.Val[int16] `db:"habvalue1percent" ` - Habvalue2 null.Val[int16] `db:"habvalue2" ` - Habvalue2percent null.Val[int16] `db:"habvalue2percent" ` - Larvaeinsidetreatedarea null.Val[int16] `db:"larvaeinsidetreatedarea" ` - Larvaeoutsidetreatedarea null.Val[int16] `db:"larvaeoutsidetreatedarea" ` - Larvaepresent null.Val[int16] `db:"larvaepresent" ` - Larvaereason null.Val[string] `db:"larvaereason" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - LR null.Val[int16] `db:"lr" ` - Mosquitohabitat null.Val[string] `db:"mosquitohabitat" ` - Movingwater null.Val[int16] `db:"movingwater" ` - Negdips null.Val[int16] `db:"negdips" ` - Nowaterever null.Val[int16] `db:"nowaterever" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Posdips null.Val[int16] `db:"posdips" ` - Potential null.Val[int16] `db:"potential" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sitetype null.Val[string] `db:"sitetype" ` - Soilconditions null.Val[string] `db:"soilconditions" ` - Sourcereduction null.Val[string] `db:"sourcereduction" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Totalacres null.Val[float64] `db:"totalacres" ` - Vegetation null.Val[string] `db:"vegetation" ` - Waterconditions null.Val[string] `db:"waterconditions" ` - Waterduration null.Val[string] `db:"waterduration" ` - Watermovement1 null.Val[string] `db:"watermovement1" ` - Watermovement1percent null.Val[int16] `db:"watermovement1percent" ` - Watermovement2 null.Val[string] `db:"watermovement2" ` - Watermovement2percent null.Val[int16] `db:"watermovement2percent" ` - Waterpresent null.Val[int16] `db:"waterpresent" ` - Watersource null.Val[string] `db:"watersource" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Acresbreeding null.Val[float64] `db:"acresbreeding" ` + Actiontaken null.Val[string] `db:"actiontaken" ` + Adultactivity null.Val[int16] `db:"adultactivity" ` + Aquaticorganisms null.Val[string] `db:"aquaticorganisms" ` + Avetemp null.Val[float64] `db:"avetemp" ` + Breedingpotential null.Val[string] `db:"breedingpotential" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Enddatetime null.Val[int64] `db:"enddatetime" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Fish null.Val[int16] `db:"fish" ` + Globalid null.Val[string] `db:"globalid" ` + Habvalue1 null.Val[int16] `db:"habvalue1" ` + Habvalue1percent null.Val[int16] `db:"habvalue1percent" ` + Habvalue2 null.Val[int16] `db:"habvalue2" ` + Habvalue2percent null.Val[int16] `db:"habvalue2percent" ` + Larvaeinsidetreatedarea null.Val[int16] `db:"larvaeinsidetreatedarea" ` + Larvaeoutsidetreatedarea null.Val[int16] `db:"larvaeoutsidetreatedarea" ` + Larvaepresent null.Val[int16] `db:"larvaepresent" ` + Larvaereason null.Val[string] `db:"larvaereason" ` + Linelocid null.Val[string] `db:"linelocid" ` + Locationname null.Val[string] `db:"locationname" ` + LR null.Val[int16] `db:"lr" ` + Mosquitohabitat null.Val[string] `db:"mosquitohabitat" ` + Movingwater null.Val[int16] `db:"movingwater" ` + Negdips null.Val[int16] `db:"negdips" ` + Nowaterever null.Val[int16] `db:"nowaterever" ` + Objectid int32 `db:"objectid,pk" ` + Pointlocid null.Val[string] `db:"pointlocid" ` + Polygonlocid null.Val[string] `db:"polygonlocid" ` + Posdips null.Val[int16] `db:"posdips" ` + Potential null.Val[int16] `db:"potential" ` + Raingauge null.Val[float64] `db:"raingauge" ` + Recordstatus null.Val[int16] `db:"recordstatus" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + Sitetype null.Val[string] `db:"sitetype" ` + Soilconditions null.Val[string] `db:"soilconditions" ` + Sourcereduction null.Val[string] `db:"sourcereduction" ` + Startdatetime null.Val[int64] `db:"startdatetime" ` + Totalacres null.Val[float64] `db:"totalacres" ` + Vegetation null.Val[string] `db:"vegetation" ` + Waterconditions null.Val[string] `db:"waterconditions" ` + Waterduration null.Val[string] `db:"waterduration" ` + Watermovement1 null.Val[string] `db:"watermovement1" ` + Watermovement1percent null.Val[int16] `db:"watermovement1percent" ` + Watermovement2 null.Val[string] `db:"watermovement2" ` + Watermovement2percent null.Val[int16] `db:"watermovement2percent" ` + Waterpresent null.Val[int16] `db:"waterpresent" ` + Watersource null.Val[string] `db:"watersource" ` + Winddir null.Val[string] `db:"winddir" ` + Windspeed null.Val[float64] `db:"windspeed" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyQamosquitoinspectionR `db:"-" ` } @@ -113,7 +115,7 @@ type historyQamosquitoinspectionR struct { func buildHistoryQamosquitoinspectionColumns(alias string) historyQamosquitoinspectionColumns { return historyQamosquitoinspectionColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "acresbreeding", "actiontaken", "adultactivity", "aquaticorganisms", "avetemp", "breedingpotential", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "fish", "globalid", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaepresent", "larvaereason", "linelocid", "locationname", "lr", "mosquitohabitat", "movingwater", "negdips", "nowaterever", "objectid", "pointlocid", "polygonlocid", "posdips", "potential", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitetype", "soilconditions", "sourcereduction", "startdatetime", "totalacres", "vegetation", "waterconditions", "waterduration", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "waterpresent", "watersource", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "acresbreeding", "actiontaken", "adultactivity", "aquaticorganisms", "avetemp", "breedingpotential", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "fish", "globalid", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaepresent", "larvaereason", "linelocid", "locationname", "lr", "mosquitohabitat", "movingwater", "negdips", "nowaterever", "objectid", "pointlocid", "polygonlocid", "posdips", "potential", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitetype", "soilconditions", "sourcereduction", "startdatetime", "totalacres", "vegetation", "waterconditions", "waterduration", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "waterpresent", "watersource", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_qamosquitoinspection"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -175,6 +177,7 @@ func buildHistoryQamosquitoinspectionColumns(alias string) historyQamosquitoinsp Windspeed: psql.Quote(alias, "windspeed"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -247,6 +250,7 @@ type historyQamosquitoinspectionColumns struct { Windspeed psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -268,77 +272,78 @@ func (historyQamosquitoinspectionColumns) AliasedAs(alias string) historyQamosqu // All values are optional, and do not have to be set // Generated columns are not included type HistoryQamosquitoinspectionSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Acresbreeding omitnull.Val[float64] `db:"acresbreeding" ` - Actiontaken omitnull.Val[string] `db:"actiontaken" ` - Adultactivity omitnull.Val[int16] `db:"adultactivity" ` - Aquaticorganisms omitnull.Val[string] `db:"aquaticorganisms" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Breedingpotential omitnull.Val[string] `db:"breedingpotential" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Fish omitnull.Val[int16] `db:"fish" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habvalue1 omitnull.Val[int16] `db:"habvalue1" ` - Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" ` - Habvalue2 omitnull.Val[int16] `db:"habvalue2" ` - Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" ` - Larvaeinsidetreatedarea omitnull.Val[int16] `db:"larvaeinsidetreatedarea" ` - Larvaeoutsidetreatedarea omitnull.Val[int16] `db:"larvaeoutsidetreatedarea" ` - Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` - Larvaereason omitnull.Val[string] `db:"larvaereason" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - LR omitnull.Val[int16] `db:"lr" ` - Mosquitohabitat omitnull.Val[string] `db:"mosquitohabitat" ` - Movingwater omitnull.Val[int16] `db:"movingwater" ` - Negdips omitnull.Val[int16] `db:"negdips" ` - Nowaterever omitnull.Val[int16] `db:"nowaterever" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Potential omitnull.Val[int16] `db:"potential" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sitetype omitnull.Val[string] `db:"sitetype" ` - Soilconditions omitnull.Val[string] `db:"soilconditions" ` - Sourcereduction omitnull.Val[string] `db:"sourcereduction" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Totalacres omitnull.Val[float64] `db:"totalacres" ` - Vegetation omitnull.Val[string] `db:"vegetation" ` - Waterconditions omitnull.Val[string] `db:"waterconditions" ` - Waterduration omitnull.Val[string] `db:"waterduration" ` - Watermovement1 omitnull.Val[string] `db:"watermovement1" ` - Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" ` - Watermovement2 omitnull.Val[string] `db:"watermovement2" ` - Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" ` - Waterpresent omitnull.Val[int16] `db:"waterpresent" ` - Watersource omitnull.Val[string] `db:"watersource" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Acresbreeding omitnull.Val[float64] `db:"acresbreeding" ` + Actiontaken omitnull.Val[string] `db:"actiontaken" ` + Adultactivity omitnull.Val[int16] `db:"adultactivity" ` + Aquaticorganisms omitnull.Val[string] `db:"aquaticorganisms" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Breedingpotential omitnull.Val[string] `db:"breedingpotential" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Enddatetime omitnull.Val[int64] `db:"enddatetime" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Fish omitnull.Val[int16] `db:"fish" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habvalue1 omitnull.Val[int16] `db:"habvalue1" ` + Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" ` + Habvalue2 omitnull.Val[int16] `db:"habvalue2" ` + Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" ` + Larvaeinsidetreatedarea omitnull.Val[int16] `db:"larvaeinsidetreatedarea" ` + Larvaeoutsidetreatedarea omitnull.Val[int16] `db:"larvaeoutsidetreatedarea" ` + Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` + Larvaereason omitnull.Val[string] `db:"larvaereason" ` + Linelocid omitnull.Val[string] `db:"linelocid" ` + Locationname omitnull.Val[string] `db:"locationname" ` + LR omitnull.Val[int16] `db:"lr" ` + Mosquitohabitat omitnull.Val[string] `db:"mosquitohabitat" ` + Movingwater omitnull.Val[int16] `db:"movingwater" ` + Negdips omitnull.Val[int16] `db:"negdips" ` + Nowaterever omitnull.Val[int16] `db:"nowaterever" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Pointlocid omitnull.Val[string] `db:"pointlocid" ` + Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` + Posdips omitnull.Val[int16] `db:"posdips" ` + Potential omitnull.Val[int16] `db:"potential" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + Sitetype omitnull.Val[string] `db:"sitetype" ` + Soilconditions omitnull.Val[string] `db:"soilconditions" ` + Sourcereduction omitnull.Val[string] `db:"sourcereduction" ` + Startdatetime omitnull.Val[int64] `db:"startdatetime" ` + Totalacres omitnull.Val[float64] `db:"totalacres" ` + Vegetation omitnull.Val[string] `db:"vegetation" ` + Waterconditions omitnull.Val[string] `db:"waterconditions" ` + Waterduration omitnull.Val[string] `db:"waterduration" ` + Watermovement1 omitnull.Val[string] `db:"watermovement1" ` + Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" ` + Watermovement2 omitnull.Val[string] `db:"watermovement2" ` + Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" ` + Waterpresent omitnull.Val[int16] `db:"waterpresent" ` + Watersource omitnull.Val[string] `db:"watersource" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryQamosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 66) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 67) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Acresbreeding.IsUnset() { @@ -515,6 +520,9 @@ func (s HistoryQamosquitoinspectionSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -540,8 +548,8 @@ func (s HistoryQamosquitoinspectionSetter) SetColumns() []string { } func (s HistoryQamosquitoinspectionSetter) Overwrite(t *HistoryQamosquitoinspection) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Acresbreeding.IsUnset() { t.Acresbreeding = s.Acresbreeding.MustGetNull() @@ -717,6 +725,9 @@ func (s HistoryQamosquitoinspectionSetter) Overwrite(t *HistoryQamosquitoinspect if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -746,9 +757,9 @@ func (s *HistoryQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 66) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 67) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1101,48 +1112,54 @@ func (s *HistoryQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { vals[58] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[59] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[59] = psql.Arg(s.Created.MustGetNull()) } else { vals[59] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[60] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[60] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[60] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[61] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[61] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[61] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[62] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[62] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[62] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[63] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[63] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[63] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[64] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[64] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[64] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[65] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[65] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[65] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[66] = psql.Arg(s.Version.MustGet()) + } else { + vals[66] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -1152,9 +1169,9 @@ func (s HistoryQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQu } func (s HistoryQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 66) + exprs := make([]bob.Expression, 0, 67) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1567,6 +1584,13 @@ func (s HistoryQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.E }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1860,7 +1884,7 @@ func (o *HistoryQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.Sele } func (os HistoryQamosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1878,7 +1902,7 @@ func (os HistoryQamosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect func attachHistoryQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyQamosquitoinspection0 *HistoryQamosquitoinspection, organization1 *Organization) (*HistoryQamosquitoinspection, error) { setter := &HistoryQamosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyQamosquitoinspection0.Update(ctx, exec, setter) @@ -1925,7 +1949,7 @@ func (historyQamosquitoinspection0 *HistoryQamosquitoinspection) AttachOrganizat } type historyQamosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Acresbreeding psql.WhereNullMod[Q, float64] Actiontaken psql.WhereNullMod[Q, string] Adultactivity psql.WhereNullMod[Q, int16] @@ -1984,6 +2008,7 @@ type historyQamosquitoinspectionWhere[Q psql.Filterable] struct { Windspeed psql.WhereNullMod[Q, float64] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1999,7 +2024,7 @@ func (historyQamosquitoinspectionWhere[Q]) AliasedAs(alias string) historyQamosq func buildHistoryQamosquitoinspectionWhere[Q psql.Filterable](cols historyQamosquitoinspectionColumns) historyQamosquitoinspectionWhere[Q] { return historyQamosquitoinspectionWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Acresbreeding: psql.WhereNull[Q, float64](cols.Acresbreeding), Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), Adultactivity: psql.WhereNull[Q, int16](cols.Adultactivity), @@ -2058,6 +2083,7 @@ func buildHistoryQamosquitoinspectionWhere[Q psql.Filterable](cols historyQamosq Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -2169,11 +2195,8 @@ func (os HistoryQamosquitoinspectionSlice) LoadOrganization(ctx context.Context, } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_rodentlocation.bob.go b/models/history_rodentlocation.bob.go index b896444e..426e58ac 100644 --- a/models/history_rodentlocation.bob.go +++ b/models/history_rodentlocation.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,40 +26,41 @@ import ( // HistoryRodentlocation is an object representing the database table. type HistoryRodentlocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Lastinspectaction null.Val[string] `db:"lastinspectaction" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectrodentevidence null.Val[string] `db:"lastinspectrodentevidence" ` - Lastinspectspecies null.Val[string] `db:"lastinspectspecies" ` - Locationname null.Val[string] `db:"locationname" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - Usetype null.Val[string] `db:"usetype" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Accessdesc null.Val[string] `db:"accessdesc" ` + Active null.Val[int16] `db:"active" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Description null.Val[string] `db:"description" ` + Externalid null.Val[string] `db:"externalid" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Habitat null.Val[string] `db:"habitat" ` + Lastinspectaction null.Val[string] `db:"lastinspectaction" ` + Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` + Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` + Lastinspectrodentevidence null.Val[string] `db:"lastinspectrodentevidence" ` + Lastinspectspecies null.Val[string] `db:"lastinspectspecies" ` + Locationname null.Val[string] `db:"locationname" ` + Locationnumber null.Val[int64] `db:"locationnumber" ` + Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` + Objectid int32 `db:"objectid,pk" ` + Priority null.Val[string] `db:"priority" ` + Symbology null.Val[string] `db:"symbology" ` + Usetype null.Val[string] `db:"usetype" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Version int32 `db:"version,pk" ` R historyRodentlocationR `db:"-" ` } @@ -81,7 +83,7 @@ type historyRodentlocationR struct { func buildHistoryRodentlocationColumns(alias string) historyRodentlocationColumns { return historyRodentlocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "lastinspectaction", "lastinspectconditions", "lastinspectdate", "lastinspectrodentevidence", "lastinspectspecies", "locationname", "locationnumber", "nextactiondatescheduled", "objectid", "priority", "symbology", "usetype", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "jurisdiction", "version", + "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "lastinspectaction", "lastinspectconditions", "lastinspectdate", "lastinspectrodentevidence", "lastinspectspecies", "locationname", "locationnumber", "nextactiondatescheduled", "objectid", "priority", "symbology", "usetype", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "jurisdiction", "version", ).WithParent("history_rodentlocation"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -110,6 +112,7 @@ func buildHistoryRodentlocationColumns(alias string) historyRodentlocationColumn Usetype: psql.Quote(alias, "usetype"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -150,6 +153,7 @@ type historyRodentlocationColumns struct { Usetype psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -172,45 +176,46 @@ func (historyRodentlocationColumns) AliasedAs(alias string) historyRodentlocatio // All values are optional, and do not have to be set // Generated columns are not included type HistoryRodentlocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Lastinspectaction omitnull.Val[string] `db:"lastinspectaction" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectrodentevidence omitnull.Val[string] `db:"lastinspectrodentevidence" ` - Lastinspectspecies omitnull.Val[string] `db:"lastinspectspecies" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Active omitnull.Val[int16] `db:"active" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Description omitnull.Val[string] `db:"description" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Lastinspectaction omitnull.Val[string] `db:"lastinspectaction" ` + Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` + Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` + Lastinspectrodentevidence omitnull.Val[string] `db:"lastinspectrodentevidence" ` + Lastinspectspecies omitnull.Val[string] `db:"lastinspectspecies" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Locationnumber omitnull.Val[int64] `db:"locationnumber" ` + Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Priority omitnull.Val[string] `db:"priority" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryRodentlocationSetter) SetColumns() []string { - vals := make([]string, 0, 34) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 35) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -288,6 +293,9 @@ func (s HistoryRodentlocationSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -316,8 +324,8 @@ func (s HistoryRodentlocationSetter) SetColumns() []string { } func (s HistoryRodentlocationSetter) Overwrite(t *HistoryRodentlocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -394,6 +402,9 @@ func (s HistoryRodentlocationSetter) Overwrite(t *HistoryRodentlocation) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -426,9 +437,9 @@ func (s *HistoryRodentlocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 34) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 35) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -583,54 +594,60 @@ func (s *HistoryRodentlocationSetter) Apply(q *dialect.InsertQuery) { vals[25] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[26] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[26] = psql.Arg(s.Created.MustGetNull()) } else { vals[26] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[27] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[27] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[27] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[28] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[28] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[28] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[29] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[29] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[29] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[30] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[30] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[30] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[31] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[31] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[31] = psql.Raw("DEFAULT") } - if !s.Jurisdiction.IsUnset() { - vals[32] = psql.Arg(s.Jurisdiction.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[32] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[32] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[33] = psql.Arg(s.Version.MustGet()) + if !s.Jurisdiction.IsUnset() { + vals[33] = psql.Arg(s.Jurisdiction.MustGetNull()) } else { vals[33] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[34] = psql.Arg(s.Version.MustGet()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -640,9 +657,9 @@ func (s HistoryRodentlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 34) + exprs := make([]bob.Expression, 0, 35) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -824,6 +841,13 @@ func (s HistoryRodentlocationSetter) Expressions(prefix ...string) []bob.Express }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1124,7 +1148,7 @@ func (o *HistoryRodentlocation) Organization(mods ...bob.Mod[*dialect.SelectQuer } func (os HistoryRodentlocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1142,7 +1166,7 @@ func (os HistoryRodentlocationSlice) Organization(mods ...bob.Mod[*dialect.Selec func attachHistoryRodentlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyRodentlocation0 *HistoryRodentlocation, organization1 *Organization) (*HistoryRodentlocation, error) { setter := &HistoryRodentlocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyRodentlocation0.Update(ctx, exec, setter) @@ -1189,7 +1213,7 @@ func (historyRodentlocation0 *HistoryRodentlocation) AttachOrganization(ctx cont } type historyRodentlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1215,6 +1239,7 @@ type historyRodentlocationWhere[Q psql.Filterable] struct { Usetype psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1231,7 +1256,7 @@ func (historyRodentlocationWhere[Q]) AliasedAs(alias string) historyRodentlocati func buildHistoryRodentlocationWhere[Q psql.Filterable](cols historyRodentlocationColumns) historyRodentlocationWhere[Q] { return historyRodentlocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1257,6 +1282,7 @@ func buildHistoryRodentlocationWhere[Q psql.Filterable](cols historyRodentlocati Usetype: psql.WhereNull[Q, string](cols.Usetype), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1369,11 +1395,8 @@ func (os HistoryRodentlocationSlice) LoadOrganization(ctx context.Context, exec } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_samplecollection.bob.go b/models/history_samplecollection.bob.go index 2575444c..e2788ea2 100644 --- a/models/history_samplecollection.bob.go +++ b/models/history_samplecollection.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,56 +26,57 @@ import ( // HistorySamplecollection is an object representing the database table. type HistorySamplecollection struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Chickenid null.Val[string] `db:"chickenid" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datesent null.Val[int64] `db:"datesent" ` - Datetested null.Val[int64] `db:"datetested" ` - Diseasepos null.Val[string] `db:"diseasepos" ` - Diseasetested null.Val[string] `db:"diseasetested" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Flockid null.Val[string] `db:"flockid" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Lab null.Val[string] `db:"lab" ` - Locationname null.Val[string] `db:"locationname" ` - LocID null.Val[string] `db:"loc_id" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Samplecond null.Val[string] `db:"samplecond" ` - Samplecount null.Val[int16] `db:"samplecount" ` - Sampleid null.Val[string] `db:"sampleid" ` - Sampletype null.Val[string] `db:"sampletype" ` - Sex null.Val[string] `db:"sex" ` - Sitecond null.Val[string] `db:"sitecond" ` - Species null.Val[string] `db:"species" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Survtech null.Val[string] `db:"survtech" ` - Testmethod null.Val[string] `db:"testmethod" ` - Testtech null.Val[string] `db:"testtech" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Activity null.Val[string] `db:"activity" ` + Avetemp null.Val[float64] `db:"avetemp" ` + Chickenid null.Val[string] `db:"chickenid" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Datesent null.Val[int64] `db:"datesent" ` + Datetested null.Val[int64] `db:"datetested" ` + Diseasepos null.Val[string] `db:"diseasepos" ` + Diseasetested null.Val[string] `db:"diseasetested" ` + Enddatetime null.Val[int64] `db:"enddatetime" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Flockid null.Val[string] `db:"flockid" ` + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + Globalid null.Val[string] `db:"globalid" ` + Lab null.Val[string] `db:"lab" ` + Locationname null.Val[string] `db:"locationname" ` + LocID null.Val[string] `db:"loc_id" ` + Objectid int32 `db:"objectid,pk" ` + Processed null.Val[int16] `db:"processed" ` + Raingauge null.Val[float64] `db:"raingauge" ` + Recordstatus null.Val[int16] `db:"recordstatus" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + Samplecond null.Val[string] `db:"samplecond" ` + Samplecount null.Val[int16] `db:"samplecount" ` + Sampleid null.Val[string] `db:"sampleid" ` + Sampletype null.Val[string] `db:"sampletype" ` + Sex null.Val[string] `db:"sex" ` + Sitecond null.Val[string] `db:"sitecond" ` + Species null.Val[string] `db:"species" ` + Startdatetime null.Val[int64] `db:"startdatetime" ` + Survtech null.Val[string] `db:"survtech" ` + Testmethod null.Val[string] `db:"testmethod" ` + Testtech null.Val[string] `db:"testtech" ` + Winddir null.Val[string] `db:"winddir" ` + Windspeed null.Val[float64] `db:"windspeed" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historySamplecollectionR `db:"-" ` } @@ -97,7 +99,7 @@ type historySamplecollectionR struct { func buildHistorySamplecollectionColumns(alias string) historySamplecollectionColumns { return historySamplecollectionColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "avetemp", "chickenid", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "enddatetime", "editdate", "editor", "fieldtech", "flockid", "gatewaysync", "globalid", "lab", "locationname", "loc_id", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "samplecond", "samplecount", "sampleid", "sampletype", "sex", "sitecond", "species", "startdatetime", "survtech", "testmethod", "testtech", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "activity", "avetemp", "chickenid", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "enddatetime", "editdate", "editor", "fieldtech", "flockid", "gatewaysync", "globalid", "lab", "locationname", "loc_id", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "samplecond", "samplecount", "sampleid", "sampletype", "sex", "sitecond", "species", "startdatetime", "survtech", "testmethod", "testtech", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_samplecollection"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -143,6 +145,7 @@ func buildHistorySamplecollectionColumns(alias string) historySamplecollectionCo Windspeed: psql.Quote(alias, "windspeed"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -199,6 +202,7 @@ type historySamplecollectionColumns struct { Windspeed psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -220,61 +224,62 @@ func (historySamplecollectionColumns) AliasedAs(alias string) historySamplecolle // All values are optional, and do not have to be set // Generated columns are not included type HistorySamplecollectionSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Chickenid omitnull.Val[string] `db:"chickenid" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datesent omitnull.Val[int64] `db:"datesent" ` - Datetested omitnull.Val[int64] `db:"datetested" ` - Diseasepos omitnull.Val[string] `db:"diseasepos" ` - Diseasetested omitnull.Val[string] `db:"diseasetested" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Flockid omitnull.Val[string] `db:"flockid" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Lab omitnull.Val[string] `db:"lab" ` - Locationname omitnull.Val[string] `db:"locationname" ` - LocID omitnull.Val[string] `db:"loc_id" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Samplecond omitnull.Val[string] `db:"samplecond" ` - Samplecount omitnull.Val[int16] `db:"samplecount" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Sampletype omitnull.Val[string] `db:"sampletype" ` - Sex omitnull.Val[string] `db:"sex" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Species omitnull.Val[string] `db:"species" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Testmethod omitnull.Val[string] `db:"testmethod" ` - Testtech omitnull.Val[string] `db:"testtech" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Activity omitnull.Val[string] `db:"activity" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Chickenid omitnull.Val[string] `db:"chickenid" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Datesent omitnull.Val[int64] `db:"datesent" ` + Datetested omitnull.Val[int64] `db:"datetested" ` + Diseasepos omitnull.Val[string] `db:"diseasepos" ` + Diseasetested omitnull.Val[string] `db:"diseasetested" ` + Enddatetime omitnull.Val[int64] `db:"enddatetime" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Flockid omitnull.Val[string] `db:"flockid" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Lab omitnull.Val[string] `db:"lab" ` + Locationname omitnull.Val[string] `db:"locationname" ` + LocID omitnull.Val[string] `db:"loc_id" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Processed omitnull.Val[int16] `db:"processed" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + Samplecond omitnull.Val[string] `db:"samplecond" ` + Samplecount omitnull.Val[int16] `db:"samplecount" ` + Sampleid omitnull.Val[string] `db:"sampleid" ` + Sampletype omitnull.Val[string] `db:"sampletype" ` + Sex omitnull.Val[string] `db:"sex" ` + Sitecond omitnull.Val[string] `db:"sitecond" ` + Species omitnull.Val[string] `db:"species" ` + Startdatetime omitnull.Val[int64] `db:"startdatetime" ` + Survtech omitnull.Val[string] `db:"survtech" ` + Testmethod omitnull.Val[string] `db:"testmethod" ` + Testtech omitnull.Val[string] `db:"testtech" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistorySamplecollectionSetter) SetColumns() []string { - vals := make([]string, 0, 50) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 51) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Activity.IsUnset() { @@ -403,6 +408,9 @@ func (s HistorySamplecollectionSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -428,8 +436,8 @@ func (s HistorySamplecollectionSetter) SetColumns() []string { } func (s HistorySamplecollectionSetter) Overwrite(t *HistorySamplecollection) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Activity.IsUnset() { t.Activity = s.Activity.MustGetNull() @@ -557,6 +565,9 @@ func (s HistorySamplecollectionSetter) Overwrite(t *HistorySamplecollection) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -586,9 +597,9 @@ func (s *HistorySamplecollectionSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 50) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 51) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -845,48 +856,54 @@ func (s *HistorySamplecollectionSetter) Apply(q *dialect.InsertQuery) { vals[42] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[43] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[43] = psql.Arg(s.Created.MustGetNull()) } else { vals[43] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[44] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[44] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[44] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[45] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[45] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[45] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[46] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[46] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[46] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[47] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[47] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[47] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[48] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[48] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[48] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[49] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[49] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[49] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[50] = psql.Arg(s.Version.MustGet()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -896,9 +913,9 @@ func (s HistorySamplecollectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s HistorySamplecollectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 50) + exprs := make([]bob.Expression, 0, 51) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1199,6 +1216,13 @@ func (s HistorySamplecollectionSetter) Expressions(prefix ...string) []bob.Expre }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1492,7 +1516,7 @@ func (o *HistorySamplecollection) Organization(mods ...bob.Mod[*dialect.SelectQu } func (os HistorySamplecollectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1510,7 +1534,7 @@ func (os HistorySamplecollectionSlice) Organization(mods ...bob.Mod[*dialect.Sel func attachHistorySamplecollectionOrganization0(ctx context.Context, exec bob.Executor, count int, historySamplecollection0 *HistorySamplecollection, organization1 *Organization) (*HistorySamplecollection, error) { setter := &HistorySamplecollectionSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historySamplecollection0.Update(ctx, exec, setter) @@ -1557,7 +1581,7 @@ func (historySamplecollection0 *HistorySamplecollection) AttachOrganization(ctx } type historySamplecollectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Activity psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] Chickenid psql.WhereNullMod[Q, string] @@ -1600,6 +1624,7 @@ type historySamplecollectionWhere[Q psql.Filterable] struct { Windspeed psql.WhereNullMod[Q, float64] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1615,7 +1640,7 @@ func (historySamplecollectionWhere[Q]) AliasedAs(alias string) historySamplecoll func buildHistorySamplecollectionWhere[Q psql.Filterable](cols historySamplecollectionColumns) historySamplecollectionWhere[Q] { return historySamplecollectionWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Activity: psql.WhereNull[Q, string](cols.Activity), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Chickenid: psql.WhereNull[Q, string](cols.Chickenid), @@ -1658,6 +1683,7 @@ func buildHistorySamplecollectionWhere[Q psql.Filterable](cols historySamplecoll Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1769,11 +1795,8 @@ func (os HistorySamplecollectionSlice) LoadOrganization(ctx context.Context, exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_samplelocation.bob.go b/models/history_samplelocation.bob.go index 555a7f59..ded806a4 100644 --- a/models/history_samplelocation.bob.go +++ b/models/history_samplelocation.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,34 +26,35 @@ import ( // HistorySamplelocation is an object representing the database table. type HistorySamplelocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Usetype null.Val[string] `db:"usetype" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Accessdesc null.Val[string] `db:"accessdesc" ` + Active null.Val[int16] `db:"active" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Description null.Val[string] `db:"description" ` + Externalid null.Val[string] `db:"externalid" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + Globalid null.Val[string] `db:"globalid" ` + Habitat null.Val[string] `db:"habitat" ` + Locationnumber null.Val[int64] `db:"locationnumber" ` + Name null.Val[string] `db:"name" ` + Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` + Objectid int32 `db:"objectid,pk" ` + Priority null.Val[string] `db:"priority" ` + Usetype null.Val[string] `db:"usetype" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historySamplelocationR `db:"-" ` } @@ -75,7 +77,7 @@ type historySamplelocationR struct { func buildHistorySamplelocationColumns(alias string) historySamplelocationColumns { return historySamplelocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_samplelocation"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -99,6 +101,7 @@ func buildHistorySamplelocationColumns(alias string) historySamplelocationColumn Usetype: psql.Quote(alias, "usetype"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -133,6 +136,7 @@ type historySamplelocationColumns struct { Usetype psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -154,39 +158,40 @@ func (historySamplelocationColumns) AliasedAs(alias string) historySamplelocatio // All values are optional, and do not have to be set // Generated columns are not included type HistorySamplelocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Active omitnull.Val[int16] `db:"active" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Description omitnull.Val[string] `db:"description" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Locationnumber omitnull.Val[int64] `db:"locationnumber" ` + Name omitnull.Val[string] `db:"name" ` + Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistorySamplelocationSetter) SetColumns() []string { - vals := make([]string, 0, 28) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 29) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -249,6 +254,9 @@ func (s HistorySamplelocationSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -274,8 +282,8 @@ func (s HistorySamplelocationSetter) SetColumns() []string { } func (s HistorySamplelocationSetter) Overwrite(t *HistorySamplelocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -337,6 +345,9 @@ func (s HistorySamplelocationSetter) Overwrite(t *HistorySamplelocation) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -366,9 +377,9 @@ func (s *HistorySamplelocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 28) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 29) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -493,48 +504,54 @@ func (s *HistorySamplelocationSetter) Apply(q *dialect.InsertQuery) { vals[20] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[21] = psql.Arg(s.Created.MustGetNull()) } else { vals[21] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[22] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[23] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[23] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[24] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[24] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[24] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[25] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[25] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[26] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[27] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[27] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[28] = psql.Arg(s.Version.MustGet()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -544,9 +561,9 @@ func (s HistorySamplelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistorySamplelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 28) + exprs := make([]bob.Expression, 0, 29) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -693,6 +710,13 @@ func (s HistorySamplelocationSetter) Expressions(prefix ...string) []bob.Express }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -986,7 +1010,7 @@ func (o *HistorySamplelocation) Organization(mods ...bob.Mod[*dialect.SelectQuer } func (os HistorySamplelocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1004,7 +1028,7 @@ func (os HistorySamplelocationSlice) Organization(mods ...bob.Mod[*dialect.Selec func attachHistorySamplelocationOrganization0(ctx context.Context, exec bob.Executor, count int, historySamplelocation0 *HistorySamplelocation, organization1 *Organization) (*HistorySamplelocation, error) { setter := &HistorySamplelocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historySamplelocation0.Update(ctx, exec, setter) @@ -1051,7 +1075,7 @@ func (historySamplelocation0 *HistorySamplelocation) AttachOrganization(ctx cont } type historySamplelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1072,6 +1096,7 @@ type historySamplelocationWhere[Q psql.Filterable] struct { Usetype psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1087,7 +1112,7 @@ func (historySamplelocationWhere[Q]) AliasedAs(alias string) historySamplelocati func buildHistorySamplelocationWhere[Q psql.Filterable](cols historySamplelocationColumns) historySamplelocationWhere[Q] { return historySamplelocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1108,6 +1133,7 @@ func buildHistorySamplelocationWhere[Q psql.Filterable](cols historySamplelocati Usetype: psql.WhereNull[Q, string](cols.Usetype), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1219,11 +1245,8 @@ func (os HistorySamplelocationSlice) LoadOrganization(ctx context.Context, exec } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_servicerequest.bob.go b/models/history_servicerequest.bob.go index 741100cc..32ca4434 100644 --- a/models/history_servicerequest.bob.go +++ b/models/history_servicerequest.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,96 +26,97 @@ import ( // HistoryServicerequest is an object representing the database table. type HistoryServicerequest struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Accepted null.Val[int16] `db:"accepted" ` - Acceptedby null.Val[string] `db:"acceptedby" ` - Accepteddate null.Val[int64] `db:"accepteddate" ` - Allowed null.Val[string] `db:"allowed" ` - Assignedtech null.Val[string] `db:"assignedtech" ` - Clraddr1 null.Val[string] `db:"clraddr1" ` - Clraddr2 null.Val[string] `db:"clraddr2" ` - Clranon null.Val[int16] `db:"clranon" ` - Clrcity null.Val[string] `db:"clrcity" ` - Clrcompany null.Val[string] `db:"clrcompany" ` - Clrcontpref null.Val[string] `db:"clrcontpref" ` - Clremail null.Val[string] `db:"clremail" ` - Clrfname null.Val[string] `db:"clrfname" ` - Clrother null.Val[string] `db:"clrother" ` - Clrphone1 null.Val[string] `db:"clrphone1" ` - Clrphone2 null.Val[string] `db:"clrphone2" ` - Clrstate null.Val[string] `db:"clrstate" ` - Clrzip null.Val[string] `db:"clrzip" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datetimeclosed null.Val[int64] `db:"datetimeclosed" ` - Duedate null.Val[int64] `db:"duedate" ` - Entrytech null.Val[string] `db:"entrytech" ` - Estcompletedate null.Val[int64] `db:"estcompletedate" ` - Externalerror null.Val[string] `db:"externalerror" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Firstresponsedate null.Val[int64] `db:"firstresponsedate" ` - Globalid null.Val[string] `db:"globalid" ` - Issuesreported null.Val[string] `db:"issuesreported" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Nextaction null.Val[string] `db:"nextaction" ` - Notificationtimestamp null.Val[string] `db:"notificationtimestamp" ` - Notified null.Val[int16] `db:"notified" ` - Notifieddate null.Val[int64] `db:"notifieddate" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Priority null.Val[string] `db:"priority" ` - Recdatetime null.Val[int64] `db:"recdatetime" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Rejectedby null.Val[string] `db:"rejectedby" ` - Rejecteddate null.Val[int64] `db:"rejecteddate" ` - Rejectedreason null.Val[string] `db:"rejectedreason" ` - Reqaddr1 null.Val[string] `db:"reqaddr1" ` - Reqaddr2 null.Val[string] `db:"reqaddr2" ` - Reqcity null.Val[string] `db:"reqcity" ` - Reqcompany null.Val[string] `db:"reqcompany" ` - Reqcrossst null.Val[string] `db:"reqcrossst" ` - Reqdescr null.Val[string] `db:"reqdescr" ` - Reqfldnotes null.Val[string] `db:"reqfldnotes" ` - Reqmapgrid null.Val[string] `db:"reqmapgrid" ` - Reqnotesforcust null.Val[string] `db:"reqnotesforcust" ` - Reqnotesfortech null.Val[string] `db:"reqnotesfortech" ` - Reqpermission null.Val[int16] `db:"reqpermission" ` - Reqprogramactions null.Val[string] `db:"reqprogramactions" ` - Reqstate null.Val[string] `db:"reqstate" ` - Reqsubdiv null.Val[string] `db:"reqsubdiv" ` - Reqtarget null.Val[string] `db:"reqtarget" ` - Reqzip null.Val[string] `db:"reqzip" ` - Responsedaycount null.Val[int16] `db:"responsedaycount" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Scheduled null.Val[int16] `db:"scheduled" ` - Scheduleddate null.Val[int64] `db:"scheduleddate" ` - Source null.Val[string] `db:"source" ` - SRNumber null.Val[int64] `db:"sr_number" ` - Status null.Val[string] `db:"status" ` - Supervisor null.Val[string] `db:"supervisor" ` - Techclosed null.Val[string] `db:"techclosed" ` - Validx null.Val[string] `db:"validx" ` - Validy null.Val[string] `db:"validy" ` - Xvalue null.Val[string] `db:"xvalue" ` - Yvalue null.Val[string] `db:"yvalue" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Dog null.Val[int64] `db:"dog" ` - Spanish null.Val[int64] `db:"spanish" ` - ScheduleNotes null.Val[string] `db:"schedule_notes" ` - SchedulePeriod null.Val[string] `db:"schedule_period" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Accepted null.Val[int16] `db:"accepted" ` + Acceptedby null.Val[string] `db:"acceptedby" ` + Accepteddate null.Val[int64] `db:"accepteddate" ` + Allowed null.Val[string] `db:"allowed" ` + Assignedtech null.Val[string] `db:"assignedtech" ` + Clraddr1 null.Val[string] `db:"clraddr1" ` + Clraddr2 null.Val[string] `db:"clraddr2" ` + Clranon null.Val[int16] `db:"clranon" ` + Clrcity null.Val[string] `db:"clrcity" ` + Clrcompany null.Val[string] `db:"clrcompany" ` + Clrcontpref null.Val[string] `db:"clrcontpref" ` + Clremail null.Val[string] `db:"clremail" ` + Clrfname null.Val[string] `db:"clrfname" ` + Clrother null.Val[string] `db:"clrother" ` + Clrphone1 null.Val[string] `db:"clrphone1" ` + Clrphone2 null.Val[string] `db:"clrphone2" ` + Clrstate null.Val[string] `db:"clrstate" ` + Clrzip null.Val[string] `db:"clrzip" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Datetimeclosed null.Val[int64] `db:"datetimeclosed" ` + Duedate null.Val[int64] `db:"duedate" ` + Entrytech null.Val[string] `db:"entrytech" ` + Estcompletedate null.Val[int64] `db:"estcompletedate" ` + Externalerror null.Val[string] `db:"externalerror" ` + Externalid null.Val[string] `db:"externalid" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Firstresponsedate null.Val[int64] `db:"firstresponsedate" ` + Globalid null.Val[string] `db:"globalid" ` + Issuesreported null.Val[string] `db:"issuesreported" ` + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Nextaction null.Val[string] `db:"nextaction" ` + Notificationtimestamp null.Val[string] `db:"notificationtimestamp" ` + Notified null.Val[int16] `db:"notified" ` + Notifieddate null.Val[int64] `db:"notifieddate" ` + Objectid int32 `db:"objectid,pk" ` + Pointlocid null.Val[string] `db:"pointlocid" ` + Priority null.Val[string] `db:"priority" ` + Recdatetime null.Val[int64] `db:"recdatetime" ` + Recordstatus null.Val[int16] `db:"recordstatus" ` + Rejectedby null.Val[string] `db:"rejectedby" ` + Rejecteddate null.Val[int64] `db:"rejecteddate" ` + Rejectedreason null.Val[string] `db:"rejectedreason" ` + Reqaddr1 null.Val[string] `db:"reqaddr1" ` + Reqaddr2 null.Val[string] `db:"reqaddr2" ` + Reqcity null.Val[string] `db:"reqcity" ` + Reqcompany null.Val[string] `db:"reqcompany" ` + Reqcrossst null.Val[string] `db:"reqcrossst" ` + Reqdescr null.Val[string] `db:"reqdescr" ` + Reqfldnotes null.Val[string] `db:"reqfldnotes" ` + Reqmapgrid null.Val[string] `db:"reqmapgrid" ` + Reqnotesforcust null.Val[string] `db:"reqnotesforcust" ` + Reqnotesfortech null.Val[string] `db:"reqnotesfortech" ` + Reqpermission null.Val[int16] `db:"reqpermission" ` + Reqprogramactions null.Val[string] `db:"reqprogramactions" ` + Reqstate null.Val[string] `db:"reqstate" ` + Reqsubdiv null.Val[string] `db:"reqsubdiv" ` + Reqtarget null.Val[string] `db:"reqtarget" ` + Reqzip null.Val[string] `db:"reqzip" ` + Responsedaycount null.Val[int16] `db:"responsedaycount" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + Scheduled null.Val[int16] `db:"scheduled" ` + Scheduleddate null.Val[int64] `db:"scheduleddate" ` + Source null.Val[string] `db:"source" ` + SRNumber null.Val[int64] `db:"sr_number" ` + Status null.Val[string] `db:"status" ` + Supervisor null.Val[string] `db:"supervisor" ` + Techclosed null.Val[string] `db:"techclosed" ` + Validx null.Val[string] `db:"validx" ` + Validy null.Val[string] `db:"validy" ` + Xvalue null.Val[string] `db:"xvalue" ` + Yvalue null.Val[string] `db:"yvalue" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Dog null.Val[int64] `db:"dog" ` + Spanish null.Val[int64] `db:"spanish" ` + ScheduleNotes null.Val[string] `db:"schedule_notes" ` + SchedulePeriod null.Val[string] `db:"schedule_period" ` + Version int32 `db:"version,pk" ` R historyServicerequestR `db:"-" ` } @@ -137,7 +139,7 @@ type historyServicerequestR struct { func buildHistoryServicerequestColumns(alias string) historyServicerequestColumns { return historyServicerequestColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accepted", "acceptedby", "accepteddate", "allowed", "assignedtech", "clraddr1", "clraddr2", "clranon", "clrcity", "clrcompany", "clrcontpref", "clremail", "clrfname", "clrother", "clrphone1", "clrphone2", "clrstate", "clrzip", "comments", "creationdate", "creator", "datetimeclosed", "duedate", "entrytech", "estcompletedate", "externalerror", "externalid", "editdate", "editor", "firstresponsedate", "globalid", "issuesreported", "jurisdiction", "nextaction", "notificationtimestamp", "notified", "notifieddate", "objectid", "pointlocid", "priority", "recdatetime", "recordstatus", "rejectedby", "rejecteddate", "rejectedreason", "reqaddr1", "reqaddr2", "reqcity", "reqcompany", "reqcrossst", "reqdescr", "reqfldnotes", "reqmapgrid", "reqnotesforcust", "reqnotesfortech", "reqpermission", "reqprogramactions", "reqstate", "reqsubdiv", "reqtarget", "reqzip", "responsedaycount", "reviewed", "reviewedby", "revieweddate", "scheduled", "scheduleddate", "source", "sr_number", "status", "supervisor", "techclosed", "validx", "validy", "xvalue", "yvalue", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "dog", "spanish", "schedule_notes", "schedule_period", "version", + "organization_id", "accepted", "acceptedby", "accepteddate", "allowed", "assignedtech", "clraddr1", "clraddr2", "clranon", "clrcity", "clrcompany", "clrcontpref", "clremail", "clrfname", "clrother", "clrphone1", "clrphone2", "clrstate", "clrzip", "comments", "creationdate", "creator", "datetimeclosed", "duedate", "entrytech", "estcompletedate", "externalerror", "externalid", "editdate", "editor", "firstresponsedate", "globalid", "issuesreported", "jurisdiction", "nextaction", "notificationtimestamp", "notified", "notifieddate", "objectid", "pointlocid", "priority", "recdatetime", "recordstatus", "rejectedby", "rejecteddate", "rejectedreason", "reqaddr1", "reqaddr2", "reqcity", "reqcompany", "reqcrossst", "reqdescr", "reqfldnotes", "reqmapgrid", "reqnotesforcust", "reqnotesfortech", "reqpermission", "reqprogramactions", "reqstate", "reqsubdiv", "reqtarget", "reqzip", "responsedaycount", "reviewed", "reviewedby", "revieweddate", "scheduled", "scheduleddate", "source", "sr_number", "status", "supervisor", "techclosed", "validx", "validy", "xvalue", "yvalue", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "dog", "spanish", "schedule_notes", "schedule_period", "version", ).WithParent("history_servicerequest"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -219,6 +221,7 @@ func buildHistoryServicerequestColumns(alias string) historyServicerequestColumn Yvalue: psql.Quote(alias, "yvalue"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -315,6 +318,7 @@ type historyServicerequestColumns struct { Yvalue psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -340,101 +344,102 @@ func (historyServicerequestColumns) AliasedAs(alias string) historyServicereques // All values are optional, and do not have to be set // Generated columns are not included type HistoryServicerequestSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Accepted omitnull.Val[int16] `db:"accepted" ` - Acceptedby omitnull.Val[string] `db:"acceptedby" ` - Accepteddate omitnull.Val[int64] `db:"accepteddate" ` - Allowed omitnull.Val[string] `db:"allowed" ` - Assignedtech omitnull.Val[string] `db:"assignedtech" ` - Clraddr1 omitnull.Val[string] `db:"clraddr1" ` - Clraddr2 omitnull.Val[string] `db:"clraddr2" ` - Clranon omitnull.Val[int16] `db:"clranon" ` - Clrcity omitnull.Val[string] `db:"clrcity" ` - Clrcompany omitnull.Val[string] `db:"clrcompany" ` - Clrcontpref omitnull.Val[string] `db:"clrcontpref" ` - Clremail omitnull.Val[string] `db:"clremail" ` - Clrfname omitnull.Val[string] `db:"clrfname" ` - Clrother omitnull.Val[string] `db:"clrother" ` - Clrphone1 omitnull.Val[string] `db:"clrphone1" ` - Clrphone2 omitnull.Val[string] `db:"clrphone2" ` - Clrstate omitnull.Val[string] `db:"clrstate" ` - Clrzip omitnull.Val[string] `db:"clrzip" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datetimeclosed omitnull.Val[int64] `db:"datetimeclosed" ` - Duedate omitnull.Val[int64] `db:"duedate" ` - Entrytech omitnull.Val[string] `db:"entrytech" ` - Estcompletedate omitnull.Val[int64] `db:"estcompletedate" ` - Externalerror omitnull.Val[string] `db:"externalerror" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Firstresponsedate omitnull.Val[int64] `db:"firstresponsedate" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Issuesreported omitnull.Val[string] `db:"issuesreported" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Nextaction omitnull.Val[string] `db:"nextaction" ` - Notificationtimestamp omitnull.Val[string] `db:"notificationtimestamp" ` - Notified omitnull.Val[int16] `db:"notified" ` - Notifieddate omitnull.Val[int64] `db:"notifieddate" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Priority omitnull.Val[string] `db:"priority" ` - Recdatetime omitnull.Val[int64] `db:"recdatetime" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Rejectedby omitnull.Val[string] `db:"rejectedby" ` - Rejecteddate omitnull.Val[int64] `db:"rejecteddate" ` - Rejectedreason omitnull.Val[string] `db:"rejectedreason" ` - Reqaddr1 omitnull.Val[string] `db:"reqaddr1" ` - Reqaddr2 omitnull.Val[string] `db:"reqaddr2" ` - Reqcity omitnull.Val[string] `db:"reqcity" ` - Reqcompany omitnull.Val[string] `db:"reqcompany" ` - Reqcrossst omitnull.Val[string] `db:"reqcrossst" ` - Reqdescr omitnull.Val[string] `db:"reqdescr" ` - Reqfldnotes omitnull.Val[string] `db:"reqfldnotes" ` - Reqmapgrid omitnull.Val[string] `db:"reqmapgrid" ` - Reqnotesforcust omitnull.Val[string] `db:"reqnotesforcust" ` - Reqnotesfortech omitnull.Val[string] `db:"reqnotesfortech" ` - Reqpermission omitnull.Val[int16] `db:"reqpermission" ` - Reqprogramactions omitnull.Val[string] `db:"reqprogramactions" ` - Reqstate omitnull.Val[string] `db:"reqstate" ` - Reqsubdiv omitnull.Val[string] `db:"reqsubdiv" ` - Reqtarget omitnull.Val[string] `db:"reqtarget" ` - Reqzip omitnull.Val[string] `db:"reqzip" ` - Responsedaycount omitnull.Val[int16] `db:"responsedaycount" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Scheduled omitnull.Val[int16] `db:"scheduled" ` - Scheduleddate omitnull.Val[int64] `db:"scheduleddate" ` - Source omitnull.Val[string] `db:"source" ` - SRNumber omitnull.Val[int64] `db:"sr_number" ` - Status omitnull.Val[string] `db:"status" ` - Supervisor omitnull.Val[string] `db:"supervisor" ` - Techclosed omitnull.Val[string] `db:"techclosed" ` - Validx omitnull.Val[string] `db:"validx" ` - Validy omitnull.Val[string] `db:"validy" ` - Xvalue omitnull.Val[string] `db:"xvalue" ` - Yvalue omitnull.Val[string] `db:"yvalue" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Dog omitnull.Val[int64] `db:"dog" ` - Spanish omitnull.Val[int64] `db:"spanish" ` - ScheduleNotes omitnull.Val[string] `db:"schedule_notes" ` - SchedulePeriod omitnull.Val[string] `db:"schedule_period" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Accepted omitnull.Val[int16] `db:"accepted" ` + Acceptedby omitnull.Val[string] `db:"acceptedby" ` + Accepteddate omitnull.Val[int64] `db:"accepteddate" ` + Allowed omitnull.Val[string] `db:"allowed" ` + Assignedtech omitnull.Val[string] `db:"assignedtech" ` + Clraddr1 omitnull.Val[string] `db:"clraddr1" ` + Clraddr2 omitnull.Val[string] `db:"clraddr2" ` + Clranon omitnull.Val[int16] `db:"clranon" ` + Clrcity omitnull.Val[string] `db:"clrcity" ` + Clrcompany omitnull.Val[string] `db:"clrcompany" ` + Clrcontpref omitnull.Val[string] `db:"clrcontpref" ` + Clremail omitnull.Val[string] `db:"clremail" ` + Clrfname omitnull.Val[string] `db:"clrfname" ` + Clrother omitnull.Val[string] `db:"clrother" ` + Clrphone1 omitnull.Val[string] `db:"clrphone1" ` + Clrphone2 omitnull.Val[string] `db:"clrphone2" ` + Clrstate omitnull.Val[string] `db:"clrstate" ` + Clrzip omitnull.Val[string] `db:"clrzip" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Datetimeclosed omitnull.Val[int64] `db:"datetimeclosed" ` + Duedate omitnull.Val[int64] `db:"duedate" ` + Entrytech omitnull.Val[string] `db:"entrytech" ` + Estcompletedate omitnull.Val[int64] `db:"estcompletedate" ` + Externalerror omitnull.Val[string] `db:"externalerror" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Firstresponsedate omitnull.Val[int64] `db:"firstresponsedate" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Issuesreported omitnull.Val[string] `db:"issuesreported" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Nextaction omitnull.Val[string] `db:"nextaction" ` + Notificationtimestamp omitnull.Val[string] `db:"notificationtimestamp" ` + Notified omitnull.Val[int16] `db:"notified" ` + Notifieddate omitnull.Val[int64] `db:"notifieddate" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Pointlocid omitnull.Val[string] `db:"pointlocid" ` + Priority omitnull.Val[string] `db:"priority" ` + Recdatetime omitnull.Val[int64] `db:"recdatetime" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Rejectedby omitnull.Val[string] `db:"rejectedby" ` + Rejecteddate omitnull.Val[int64] `db:"rejecteddate" ` + Rejectedreason omitnull.Val[string] `db:"rejectedreason" ` + Reqaddr1 omitnull.Val[string] `db:"reqaddr1" ` + Reqaddr2 omitnull.Val[string] `db:"reqaddr2" ` + Reqcity omitnull.Val[string] `db:"reqcity" ` + Reqcompany omitnull.Val[string] `db:"reqcompany" ` + Reqcrossst omitnull.Val[string] `db:"reqcrossst" ` + Reqdescr omitnull.Val[string] `db:"reqdescr" ` + Reqfldnotes omitnull.Val[string] `db:"reqfldnotes" ` + Reqmapgrid omitnull.Val[string] `db:"reqmapgrid" ` + Reqnotesforcust omitnull.Val[string] `db:"reqnotesforcust" ` + Reqnotesfortech omitnull.Val[string] `db:"reqnotesfortech" ` + Reqpermission omitnull.Val[int16] `db:"reqpermission" ` + Reqprogramactions omitnull.Val[string] `db:"reqprogramactions" ` + Reqstate omitnull.Val[string] `db:"reqstate" ` + Reqsubdiv omitnull.Val[string] `db:"reqsubdiv" ` + Reqtarget omitnull.Val[string] `db:"reqtarget" ` + Reqzip omitnull.Val[string] `db:"reqzip" ` + Responsedaycount omitnull.Val[int16] `db:"responsedaycount" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + Scheduled omitnull.Val[int16] `db:"scheduled" ` + Scheduleddate omitnull.Val[int64] `db:"scheduleddate" ` + Source omitnull.Val[string] `db:"source" ` + SRNumber omitnull.Val[int64] `db:"sr_number" ` + Status omitnull.Val[string] `db:"status" ` + Supervisor omitnull.Val[string] `db:"supervisor" ` + Techclosed omitnull.Val[string] `db:"techclosed" ` + Validx omitnull.Val[string] `db:"validx" ` + Validy omitnull.Val[string] `db:"validy" ` + Xvalue omitnull.Val[string] `db:"xvalue" ` + Yvalue omitnull.Val[string] `db:"yvalue" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Dog omitnull.Val[int64] `db:"dog" ` + Spanish omitnull.Val[int64] `db:"spanish" ` + ScheduleNotes omitnull.Val[string] `db:"schedule_notes" ` + SchedulePeriod omitnull.Val[string] `db:"schedule_period" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryServicerequestSetter) SetColumns() []string { - vals := make([]string, 0, 90) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 91) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accepted.IsUnset() { @@ -671,6 +676,9 @@ func (s HistoryServicerequestSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -708,8 +716,8 @@ func (s HistoryServicerequestSetter) SetColumns() []string { } func (s HistoryServicerequestSetter) Overwrite(t *HistoryServicerequest) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accepted.IsUnset() { t.Accepted = s.Accepted.MustGetNull() @@ -945,6 +953,9 @@ func (s HistoryServicerequestSetter) Overwrite(t *HistoryServicerequest) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -986,9 +997,9 @@ func (s *HistoryServicerequestSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 90) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 91) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1461,72 +1472,78 @@ func (s *HistoryServicerequestSetter) Apply(q *dialect.InsertQuery) { vals[78] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[79] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[79] = psql.Arg(s.Created.MustGetNull()) } else { vals[79] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[80] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[80] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[80] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[81] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[81] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[81] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[82] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[82] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[82] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[83] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[83] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[83] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[84] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[84] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[84] = psql.Raw("DEFAULT") } - if !s.Dog.IsUnset() { - vals[85] = psql.Arg(s.Dog.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[85] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[85] = psql.Raw("DEFAULT") } - if !s.Spanish.IsUnset() { - vals[86] = psql.Arg(s.Spanish.MustGetNull()) + if !s.Dog.IsUnset() { + vals[86] = psql.Arg(s.Dog.MustGetNull()) } else { vals[86] = psql.Raw("DEFAULT") } - if !s.ScheduleNotes.IsUnset() { - vals[87] = psql.Arg(s.ScheduleNotes.MustGetNull()) + if !s.Spanish.IsUnset() { + vals[87] = psql.Arg(s.Spanish.MustGetNull()) } else { vals[87] = psql.Raw("DEFAULT") } - if !s.SchedulePeriod.IsUnset() { - vals[88] = psql.Arg(s.SchedulePeriod.MustGetNull()) + if !s.ScheduleNotes.IsUnset() { + vals[88] = psql.Arg(s.ScheduleNotes.MustGetNull()) } else { vals[88] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[89] = psql.Arg(s.Version.MustGet()) + if !s.SchedulePeriod.IsUnset() { + vals[89] = psql.Arg(s.SchedulePeriod.MustGetNull()) } else { vals[89] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[90] = psql.Arg(s.Version.MustGet()) + } else { + vals[90] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -1536,9 +1553,9 @@ func (s HistoryServicerequestSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryServicerequestSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 90) + exprs := make([]bob.Expression, 0, 91) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -2091,6 +2108,13 @@ func (s HistoryServicerequestSetter) Expressions(prefix ...string) []bob.Express }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -2412,7 +2436,7 @@ func (o *HistoryServicerequest) Organization(mods ...bob.Mod[*dialect.SelectQuer } func (os HistoryServicerequestSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -2430,7 +2454,7 @@ func (os HistoryServicerequestSlice) Organization(mods ...bob.Mod[*dialect.Selec func attachHistoryServicerequestOrganization0(ctx context.Context, exec bob.Executor, count int, historyServicerequest0 *HistoryServicerequest, organization1 *Organization) (*HistoryServicerequest, error) { setter := &HistoryServicerequestSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyServicerequest0.Update(ctx, exec, setter) @@ -2477,7 +2501,7 @@ func (historyServicerequest0 *HistoryServicerequest) AttachOrganization(ctx cont } type historyServicerequestWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accepted psql.WhereNullMod[Q, int16] Acceptedby psql.WhereNullMod[Q, string] Accepteddate psql.WhereNullMod[Q, int64] @@ -2556,6 +2580,7 @@ type historyServicerequestWhere[Q psql.Filterable] struct { Yvalue psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -2575,7 +2600,7 @@ func (historyServicerequestWhere[Q]) AliasedAs(alias string) historyServicereque func buildHistoryServicerequestWhere[Q psql.Filterable](cols historyServicerequestColumns) historyServicerequestWhere[Q] { return historyServicerequestWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accepted: psql.WhereNull[Q, int16](cols.Accepted), Acceptedby: psql.WhereNull[Q, string](cols.Acceptedby), Accepteddate: psql.WhereNull[Q, int64](cols.Accepteddate), @@ -2654,6 +2679,7 @@ func buildHistoryServicerequestWhere[Q psql.Filterable](cols historyServicereque Yvalue: psql.WhereNull[Q, string](cols.Yvalue), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -2769,11 +2795,8 @@ func (os HistoryServicerequestSlice) LoadOrganization(ctx context.Context, exec } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_speciesabundance.bob.go b/models/history_speciesabundance.bob.go index 7064dd75..bd527956 100644 --- a/models/history_speciesabundance.bob.go +++ b/models/history_speciesabundance.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,39 +26,40 @@ import ( // HistorySpeciesabundance is an object representing the database table. type HistorySpeciesabundance struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Bloodedfem null.Val[int16] `db:"bloodedfem" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Eggs null.Val[int16] `db:"eggs" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Females null.Val[int64] `db:"females" ` - Gravidfem null.Val[int16] `db:"gravidfem" ` - Globalid null.Val[string] `db:"globalid" ` - Larvae null.Val[int16] `db:"larvae" ` - Males null.Val[int16] `db:"males" ` - Objectid int32 `db:"objectid,pk" ` - Poolstogen null.Val[int16] `db:"poolstogen" ` - Processed null.Val[int16] `db:"processed" ` - Pupae null.Val[int16] `db:"pupae" ` - Species null.Val[string] `db:"species" ` - Total null.Val[int64] `db:"total" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - Unknown null.Val[int16] `db:"unknown" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Globalzscore null.Val[float64] `db:"globalzscore" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - R7score null.Val[float64] `db:"r7score" ` - R8score null.Val[float64] `db:"r8score" ` - Yearweek null.Val[int64] `db:"yearweek" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Bloodedfem null.Val[int16] `db:"bloodedfem" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Eggs null.Val[int16] `db:"eggs" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Females null.Val[int64] `db:"females" ` + Gravidfem null.Val[int16] `db:"gravidfem" ` + Globalid null.Val[string] `db:"globalid" ` + Larvae null.Val[int16] `db:"larvae" ` + Males null.Val[int16] `db:"males" ` + Objectid int32 `db:"objectid,pk" ` + Poolstogen null.Val[int16] `db:"poolstogen" ` + Processed null.Val[int16] `db:"processed" ` + Pupae null.Val[int16] `db:"pupae" ` + Species null.Val[string] `db:"species" ` + Total null.Val[int64] `db:"total" ` + TrapdataID null.Val[string] `db:"trapdata_id" ` + Unknown null.Val[int16] `db:"unknown" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Globalzscore null.Val[float64] `db:"globalzscore" ` + H3R7 null.Val[string] `db:"h3r7" ` + H3R8 null.Val[string] `db:"h3r8" ` + R7score null.Val[float64] `db:"r7score" ` + R8score null.Val[float64] `db:"r8score" ` + Yearweek null.Val[int64] `db:"yearweek" ` + Version int32 `db:"version,pk" ` R historySpeciesabundanceR `db:"-" ` } @@ -80,7 +82,7 @@ type historySpeciesabundanceR struct { func buildHistorySpeciesabundanceColumns(alias string) historySpeciesabundanceColumns { return historySpeciesabundanceColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "bloodedfem", "creationdate", "creator", "eggs", "editdate", "editor", "females", "gravidfem", "globalid", "larvae", "males", "objectid", "poolstogen", "processed", "pupae", "species", "total", "trapdata_id", "unknown", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "globalzscore", "h3r7", "h3r8", "r7score", "r8score", "yearweek", "version", + "organization_id", "bloodedfem", "creationdate", "creator", "eggs", "editdate", "editor", "females", "gravidfem", "globalid", "larvae", "males", "objectid", "poolstogen", "processed", "pupae", "species", "total", "trapdata_id", "unknown", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "globalzscore", "h3r7", "h3r8", "r7score", "r8score", "yearweek", "version", ).WithParent("history_speciesabundance"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -103,6 +105,7 @@ func buildHistorySpeciesabundanceColumns(alias string) historySpeciesabundanceCo Total: psql.Quote(alias, "total"), TrapdataID: psql.Quote(alias, "trapdata_id"), Unknown: psql.Quote(alias, "unknown"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -142,6 +145,7 @@ type historySpeciesabundanceColumns struct { Total psql.Expression TrapdataID psql.Expression Unknown psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -169,44 +173,45 @@ func (historySpeciesabundanceColumns) AliasedAs(alias string) historySpeciesabun // All values are optional, and do not have to be set // Generated columns are not included type HistorySpeciesabundanceSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Bloodedfem omitnull.Val[int16] `db:"bloodedfem" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Females omitnull.Val[int64] `db:"females" ` - Gravidfem omitnull.Val[int16] `db:"gravidfem" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Larvae omitnull.Val[int16] `db:"larvae" ` - Males omitnull.Val[int16] `db:"males" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Poolstogen omitnull.Val[int16] `db:"poolstogen" ` - Processed omitnull.Val[int16] `db:"processed" ` - Pupae omitnull.Val[int16] `db:"pupae" ` - Species omitnull.Val[string] `db:"species" ` - Total omitnull.Val[int64] `db:"total" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - Unknown omitnull.Val[int16] `db:"unknown" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Globalzscore omitnull.Val[float64] `db:"globalzscore" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - R7score omitnull.Val[float64] `db:"r7score" ` - R8score omitnull.Val[float64] `db:"r8score" ` - Yearweek omitnull.Val[int64] `db:"yearweek" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Bloodedfem omitnull.Val[int16] `db:"bloodedfem" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Eggs omitnull.Val[int16] `db:"eggs" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Females omitnull.Val[int64] `db:"females" ` + Gravidfem omitnull.Val[int16] `db:"gravidfem" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Larvae omitnull.Val[int16] `db:"larvae" ` + Males omitnull.Val[int16] `db:"males" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Poolstogen omitnull.Val[int16] `db:"poolstogen" ` + Processed omitnull.Val[int16] `db:"processed" ` + Pupae omitnull.Val[int16] `db:"pupae" ` + Species omitnull.Val[string] `db:"species" ` + Total omitnull.Val[int64] `db:"total" ` + TrapdataID omitnull.Val[string] `db:"trapdata_id" ` + Unknown omitnull.Val[int16] `db:"unknown" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Globalzscore omitnull.Val[float64] `db:"globalzscore" ` + H3R7 omitnull.Val[string] `db:"h3r7" ` + H3R8 omitnull.Val[string] `db:"h3r8" ` + R7score omitnull.Val[float64] `db:"r7score" ` + R8score omitnull.Val[float64] `db:"r8score" ` + Yearweek omitnull.Val[int64] `db:"yearweek" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistorySpeciesabundanceSetter) SetColumns() []string { - vals := make([]string, 0, 33) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 34) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Bloodedfem.IsUnset() { @@ -266,6 +271,9 @@ func (s HistorySpeciesabundanceSetter) SetColumns() []string { if !s.Unknown.IsUnset() { vals = append(vals, "unknown") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -309,8 +317,8 @@ func (s HistorySpeciesabundanceSetter) SetColumns() []string { } func (s HistorySpeciesabundanceSetter) Overwrite(t *HistorySpeciesabundance) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Bloodedfem.IsUnset() { t.Bloodedfem = s.Bloodedfem.MustGetNull() @@ -369,6 +377,9 @@ func (s HistorySpeciesabundanceSetter) Overwrite(t *HistorySpeciesabundance) { if !s.Unknown.IsUnset() { t.Unknown = s.Unknown.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -416,9 +427,9 @@ func (s *HistorySpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 33) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 34) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -537,84 +548,90 @@ func (s *HistorySpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { vals[19] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[20] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[20] = psql.Arg(s.Created.MustGetNull()) } else { vals[20] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[21] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[21] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[22] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[22] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[23] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[23] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[23] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[24] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[24] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[24] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[25] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[25] = psql.Raw("DEFAULT") } - if !s.Globalzscore.IsUnset() { - vals[26] = psql.Arg(s.Globalzscore.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[26] = psql.Raw("DEFAULT") } - if !s.H3R7.IsUnset() { - vals[27] = psql.Arg(s.H3R7.MustGetNull()) + if !s.Globalzscore.IsUnset() { + vals[27] = psql.Arg(s.Globalzscore.MustGetNull()) } else { vals[27] = psql.Raw("DEFAULT") } - if !s.H3R8.IsUnset() { - vals[28] = psql.Arg(s.H3R8.MustGetNull()) + if !s.H3R7.IsUnset() { + vals[28] = psql.Arg(s.H3R7.MustGetNull()) } else { vals[28] = psql.Raw("DEFAULT") } - if !s.R7score.IsUnset() { - vals[29] = psql.Arg(s.R7score.MustGetNull()) + if !s.H3R8.IsUnset() { + vals[29] = psql.Arg(s.H3R8.MustGetNull()) } else { vals[29] = psql.Raw("DEFAULT") } - if !s.R8score.IsUnset() { - vals[30] = psql.Arg(s.R8score.MustGetNull()) + if !s.R7score.IsUnset() { + vals[30] = psql.Arg(s.R7score.MustGetNull()) } else { vals[30] = psql.Raw("DEFAULT") } - if !s.Yearweek.IsUnset() { - vals[31] = psql.Arg(s.Yearweek.MustGetNull()) + if !s.R8score.IsUnset() { + vals[31] = psql.Arg(s.R8score.MustGetNull()) } else { vals[31] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[32] = psql.Arg(s.Version.MustGet()) + if !s.Yearweek.IsUnset() { + vals[32] = psql.Arg(s.Yearweek.MustGetNull()) } else { vals[32] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[33] = psql.Arg(s.Version.MustGet()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -624,9 +641,9 @@ func (s HistorySpeciesabundanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s HistorySpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 33) + exprs := make([]bob.Expression, 0, 34) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -766,6 +783,13 @@ func (s HistorySpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expre }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1101,7 +1125,7 @@ func (o *HistorySpeciesabundance) Organization(mods ...bob.Mod[*dialect.SelectQu } func (os HistorySpeciesabundanceSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1119,7 +1143,7 @@ func (os HistorySpeciesabundanceSlice) Organization(mods ...bob.Mod[*dialect.Sel func attachHistorySpeciesabundanceOrganization0(ctx context.Context, exec bob.Executor, count int, historySpeciesabundance0 *HistorySpeciesabundance, organization1 *Organization) (*HistorySpeciesabundance, error) { setter := &HistorySpeciesabundanceSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historySpeciesabundance0.Update(ctx, exec, setter) @@ -1166,7 +1190,7 @@ func (historySpeciesabundance0 *HistorySpeciesabundance) AttachOrganization(ctx } type historySpeciesabundanceWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Bloodedfem psql.WhereNullMod[Q, int16] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -1186,6 +1210,7 @@ type historySpeciesabundanceWhere[Q psql.Filterable] struct { Total psql.WhereNullMod[Q, int64] TrapdataID psql.WhereNullMod[Q, string] Unknown psql.WhereNullMod[Q, int16] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1207,7 +1232,7 @@ func (historySpeciesabundanceWhere[Q]) AliasedAs(alias string) historySpeciesabu func buildHistorySpeciesabundanceWhere[Q psql.Filterable](cols historySpeciesabundanceColumns) historySpeciesabundanceWhere[Q] { return historySpeciesabundanceWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Bloodedfem: psql.WhereNull[Q, int16](cols.Bloodedfem), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1227,6 +1252,7 @@ func buildHistorySpeciesabundanceWhere[Q psql.Filterable](cols historySpeciesabu Total: psql.WhereNull[Q, int64](cols.Total), TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), Unknown: psql.WhereNull[Q, int16](cols.Unknown), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1344,11 +1370,8 @@ func (os HistorySpeciesabundanceSlice) LoadOrganization(ctx context.Context, exe } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_stormdrain.bob.go b/models/history_stormdrain.bob.go index 886f7920..03e8fe48 100644 --- a/models/history_stormdrain.bob.go +++ b/models/history_stormdrain.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,29 +26,30 @@ import ( // HistoryStormdrain is an object representing the database table. type HistoryStormdrain struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Lastaction null.Val[string] `db:"lastaction" ` - Laststatus null.Val[string] `db:"laststatus" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Nexttreatmentdate null.Val[int64] `db:"nexttreatmentdate" ` - Objectid int32 `db:"objectid,pk" ` - Symbology null.Val[string] `db:"symbology" ` - Type null.Val[string] `db:"type" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Lastaction null.Val[string] `db:"lastaction" ` + Laststatus null.Val[string] `db:"laststatus" ` + Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` + Nexttreatmentdate null.Val[int64] `db:"nexttreatmentdate" ` + Objectid int32 `db:"objectid,pk" ` + Symbology null.Val[string] `db:"symbology" ` + Type null.Val[string] `db:"type" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyStormdrainR `db:"-" ` } @@ -70,7 +72,7 @@ type historyStormdrainR struct { func buildHistoryStormdrainColumns(alias string) historyStormdrainColumns { return historyStormdrainColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "jurisdiction", "lastaction", "laststatus", "lasttreatdate", "nexttreatmentdate", "objectid", "symbology", "type", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "jurisdiction", "lastaction", "laststatus", "lasttreatdate", "nexttreatmentdate", "objectid", "symbology", "type", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_stormdrain"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -89,6 +91,7 @@ func buildHistoryStormdrainColumns(alias string) historyStormdrainColumns { Type: psql.Quote(alias, "type"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -118,6 +121,7 @@ type historyStormdrainColumns struct { Type psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -139,34 +143,35 @@ func (historyStormdrainColumns) AliasedAs(alias string) historyStormdrainColumns // All values are optional, and do not have to be set // Generated columns are not included type HistoryStormdrainSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Lastaction omitnull.Val[string] `db:"lastaction" ` - Laststatus omitnull.Val[string] `db:"laststatus" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Nexttreatmentdate omitnull.Val[int64] `db:"nexttreatmentdate" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Type omitnull.Val[string] `db:"type" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Lastaction omitnull.Val[string] `db:"lastaction" ` + Laststatus omitnull.Val[string] `db:"laststatus" ` + Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` + Nexttreatmentdate omitnull.Val[int64] `db:"nexttreatmentdate" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Type omitnull.Val[string] `db:"type" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryStormdrainSetter) SetColumns() []string { - vals := make([]string, 0, 23) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 24) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -214,6 +219,9 @@ func (s HistoryStormdrainSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -239,8 +247,8 @@ func (s HistoryStormdrainSetter) SetColumns() []string { } func (s HistoryStormdrainSetter) Overwrite(t *HistoryStormdrain) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -287,6 +295,9 @@ func (s HistoryStormdrainSetter) Overwrite(t *HistoryStormdrain) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -316,9 +327,9 @@ func (s *HistoryStormdrainSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 23) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 24) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -413,48 +424,54 @@ func (s *HistoryStormdrainSetter) Apply(q *dialect.InsertQuery) { vals[15] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[16] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[16] = psql.Arg(s.Created.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[17] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[17] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[17] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[18] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[18] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[18] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[19] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[19] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[19] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[20] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[20] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[20] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[21] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[21] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[21] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[22] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[22] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[22] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[23] = psql.Arg(s.Version.MustGet()) + } else { + vals[23] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -464,9 +481,9 @@ func (s HistoryStormdrainSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryStormdrainSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 23) + exprs := make([]bob.Expression, 0, 24) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -578,6 +595,13 @@ func (s HistoryStormdrainSetter) Expressions(prefix ...string) []bob.Expression }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -871,7 +895,7 @@ func (o *HistoryStormdrain) Organization(mods ...bob.Mod[*dialect.SelectQuery]) } func (os HistoryStormdrainSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -889,7 +913,7 @@ func (os HistoryStormdrainSlice) Organization(mods ...bob.Mod[*dialect.SelectQue func attachHistoryStormdrainOrganization0(ctx context.Context, exec bob.Executor, count int, historyStormdrain0 *HistoryStormdrain, organization1 *Organization) (*HistoryStormdrain, error) { setter := &HistoryStormdrainSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyStormdrain0.Update(ctx, exec, setter) @@ -936,7 +960,7 @@ func (historyStormdrain0 *HistoryStormdrain) AttachOrganization(ctx context.Cont } type historyStormdrainWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -952,6 +976,7 @@ type historyStormdrainWhere[Q psql.Filterable] struct { Type psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -967,7 +992,7 @@ func (historyStormdrainWhere[Q]) AliasedAs(alias string) historyStormdrainWhere[ func buildHistoryStormdrainWhere[Q psql.Filterable](cols historyStormdrainColumns) historyStormdrainWhere[Q] { return historyStormdrainWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -983,6 +1008,7 @@ func buildHistoryStormdrainWhere[Q psql.Filterable](cols historyStormdrainColumn Type: psql.WhereNull[Q, string](cols.Type), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1094,11 +1120,8 @@ func (os HistoryStormdrainSlice) LoadOrganization(ctx context.Context, exec bob. } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_timecard.bob.go b/models/history_timecard.bob.go index 24aca5de..78538bd8 100644 --- a/models/history_timecard.bob.go +++ b/models/history_timecard.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,38 +26,39 @@ import ( // HistoryTimecard is an object representing the database table. type HistoryTimecard struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Equiptype null.Val[string] `db:"equiptype" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` - Lclocid null.Val[string] `db:"lclocid" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Samplelocid null.Val[string] `db:"samplelocid" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Traplocid null.Val[string] `db:"traplocid" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Rodentlocid null.Val[string] `db:"rodentlocid" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Activity null.Val[string] `db:"activity" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Enddatetime null.Val[int64] `db:"enddatetime" ` + Equiptype null.Val[string] `db:"equiptype" ` + Externalid null.Val[string] `db:"externalid" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Globalid null.Val[string] `db:"globalid" ` + Lclocid null.Val[string] `db:"lclocid" ` + Linelocid null.Val[string] `db:"linelocid" ` + Locationname null.Val[string] `db:"locationname" ` + Objectid int32 `db:"objectid,pk" ` + Pointlocid null.Val[string] `db:"pointlocid" ` + Polygonlocid null.Val[string] `db:"polygonlocid" ` + Samplelocid null.Val[string] `db:"samplelocid" ` + Srid null.Val[string] `db:"srid" ` + Startdatetime null.Val[int64] `db:"startdatetime" ` + Traplocid null.Val[string] `db:"traplocid" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Rodentlocid null.Val[string] `db:"rodentlocid" ` + Version int32 `db:"version,pk" ` R historyTimecardR `db:"-" ` } @@ -79,7 +81,7 @@ type historyTimecardR struct { func buildHistoryTimecardColumns(alias string) historyTimecardColumns { return historyTimecardColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "comments", "creationdate", "creator", "enddatetime", "equiptype", "externalid", "editdate", "editor", "fieldtech", "globalid", "lclocid", "linelocid", "locationname", "objectid", "pointlocid", "polygonlocid", "samplelocid", "srid", "startdatetime", "traplocid", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "rodentlocid", "version", + "organization_id", "activity", "comments", "creationdate", "creator", "enddatetime", "equiptype", "externalid", "editdate", "editor", "fieldtech", "globalid", "lclocid", "linelocid", "locationname", "objectid", "pointlocid", "polygonlocid", "samplelocid", "srid", "startdatetime", "traplocid", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "rodentlocid", "version", ).WithParent("history_timecard"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -106,6 +108,7 @@ func buildHistoryTimecardColumns(alias string) historyTimecardColumns { Traplocid: psql.Quote(alias, "traplocid"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -144,6 +147,7 @@ type historyTimecardColumns struct { Traplocid psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -166,43 +170,44 @@ func (historyTimecardColumns) AliasedAs(alias string) historyTimecardColumns { // All values are optional, and do not have to be set // Generated columns are not included type HistoryTimecardSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Equiptype omitnull.Val[string] `db:"equiptype" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Lclocid omitnull.Val[string] `db:"lclocid" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Samplelocid omitnull.Val[string] `db:"samplelocid" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Traplocid omitnull.Val[string] `db:"traplocid" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Rodentlocid omitnull.Val[string] `db:"rodentlocid" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Activity omitnull.Val[string] `db:"activity" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Enddatetime omitnull.Val[int64] `db:"enddatetime" ` + Equiptype omitnull.Val[string] `db:"equiptype" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Lclocid omitnull.Val[string] `db:"lclocid" ` + Linelocid omitnull.Val[string] `db:"linelocid" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Pointlocid omitnull.Val[string] `db:"pointlocid" ` + Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` + Samplelocid omitnull.Val[string] `db:"samplelocid" ` + Srid omitnull.Val[string] `db:"srid" ` + Startdatetime omitnull.Val[int64] `db:"startdatetime" ` + Traplocid omitnull.Val[string] `db:"traplocid" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Rodentlocid omitnull.Val[string] `db:"rodentlocid" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryTimecardSetter) SetColumns() []string { - vals := make([]string, 0, 32) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 33) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Activity.IsUnset() { @@ -274,6 +279,9 @@ func (s HistoryTimecardSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -302,8 +310,8 @@ func (s HistoryTimecardSetter) SetColumns() []string { } func (s HistoryTimecardSetter) Overwrite(t *HistoryTimecard) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Activity.IsUnset() { t.Activity = s.Activity.MustGetNull() @@ -374,6 +382,9 @@ func (s HistoryTimecardSetter) Overwrite(t *HistoryTimecard) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -406,9 +417,9 @@ func (s *HistoryTimecardSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 32) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 33) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -551,54 +562,60 @@ func (s *HistoryTimecardSetter) Apply(q *dialect.InsertQuery) { vals[23] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[24] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[24] = psql.Arg(s.Created.MustGetNull()) } else { vals[24] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[25] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[25] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[25] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[26] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[26] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[26] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[27] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[27] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[27] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[28] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[28] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[28] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[29] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[29] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[29] = psql.Raw("DEFAULT") } - if !s.Rodentlocid.IsUnset() { - vals[30] = psql.Arg(s.Rodentlocid.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[30] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[30] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[31] = psql.Arg(s.Version.MustGet()) + if !s.Rodentlocid.IsUnset() { + vals[31] = psql.Arg(s.Rodentlocid.MustGetNull()) } else { vals[31] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[32] = psql.Arg(s.Version.MustGet()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -608,9 +625,9 @@ func (s HistoryTimecardSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryTimecardSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 32) + exprs := make([]bob.Expression, 0, 33) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -778,6 +795,13 @@ func (s HistoryTimecardSetter) Expressions(prefix ...string) []bob.Expression { }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1078,7 +1102,7 @@ func (o *HistoryTimecard) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Or } func (os HistoryTimecardSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1096,7 +1120,7 @@ func (os HistoryTimecardSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery func attachHistoryTimecardOrganization0(ctx context.Context, exec bob.Executor, count int, historyTimecard0 *HistoryTimecard, organization1 *Organization) (*HistoryTimecard, error) { setter := &HistoryTimecardSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyTimecard0.Update(ctx, exec, setter) @@ -1143,7 +1167,7 @@ func (historyTimecard0 *HistoryTimecard) AttachOrganization(ctx context.Context, } type historyTimecardWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Activity psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] @@ -1167,6 +1191,7 @@ type historyTimecardWhere[Q psql.Filterable] struct { Traplocid psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1183,7 +1208,7 @@ func (historyTimecardWhere[Q]) AliasedAs(alias string) historyTimecardWhere[Q] { func buildHistoryTimecardWhere[Q psql.Filterable](cols historyTimecardColumns) historyTimecardWhere[Q] { return historyTimecardWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Activity: psql.WhereNull[Q, string](cols.Activity), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), @@ -1207,6 +1232,7 @@ func buildHistoryTimecardWhere[Q psql.Filterable](cols historyTimecardColumns) h Traplocid: psql.WhereNull[Q, string](cols.Traplocid), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1319,11 +1345,8 @@ func (os HistoryTimecardSlice) LoadOrganization(ctx context.Context, exec bob.Ex } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_trapdata.bob.go b/models/history_trapdata.bob.go index 6f9977d2..1904e426 100644 --- a/models/history_trapdata.bob.go +++ b/models/history_trapdata.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,52 +26,53 @@ import ( // HistoryTrapdatum is an object representing the database table. type HistoryTrapdatum struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Field null.Val[int64] `db:"field" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Idbytech null.Val[string] `db:"idbytech" ` - Locationname null.Val[string] `db:"locationname" ` - LocID null.Val[string] `db:"loc_id" ` - LR null.Val[int16] `db:"lr" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sitecond null.Val[string] `db:"sitecond" ` - Sortbytech null.Val[string] `db:"sortbytech" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Trapactivitytype null.Val[string] `db:"trapactivitytype" ` - Trapcondition null.Val[string] `db:"trapcondition" ` - Trapnights null.Val[int16] `db:"trapnights" ` - Traptype null.Val[string] `db:"traptype" ` - Voltage null.Val[float64] `db:"voltage" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Lure null.Val[string] `db:"lure" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid null.Val[string] `db:"vectorsurvtraplocationid" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Avetemp null.Val[float64] `db:"avetemp" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Enddatetime null.Val[int64] `db:"enddatetime" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Fieldtech null.Val[string] `db:"fieldtech" ` + Field null.Val[int64] `db:"field" ` + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + Globalid null.Val[string] `db:"globalid" ` + Idbytech null.Val[string] `db:"idbytech" ` + Locationname null.Val[string] `db:"locationname" ` + LocID null.Val[string] `db:"loc_id" ` + LR null.Val[int16] `db:"lr" ` + Objectid int32 `db:"objectid,pk" ` + Processed null.Val[int16] `db:"processed" ` + Raingauge null.Val[float64] `db:"raingauge" ` + Recordstatus null.Val[int16] `db:"recordstatus" ` + Reviewed null.Val[int16] `db:"reviewed" ` + Reviewedby null.Val[string] `db:"reviewedby" ` + Revieweddate null.Val[int64] `db:"revieweddate" ` + Sitecond null.Val[string] `db:"sitecond" ` + Sortbytech null.Val[string] `db:"sortbytech" ` + Srid null.Val[string] `db:"srid" ` + Startdatetime null.Val[int64] `db:"startdatetime" ` + Trapactivitytype null.Val[string] `db:"trapactivitytype" ` + Trapcondition null.Val[string] `db:"trapcondition" ` + Trapnights null.Val[int16] `db:"trapnights" ` + Traptype null.Val[string] `db:"traptype" ` + Voltage null.Val[float64] `db:"voltage" ` + Winddir null.Val[string] `db:"winddir" ` + Windspeed null.Val[float64] `db:"windspeed" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Lure null.Val[string] `db:"lure" ` + Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` + Vectorsurvtraplocationid null.Val[string] `db:"vectorsurvtraplocationid" ` + Version int32 `db:"version,pk" ` R historyTrapdatumR `db:"-" ` } @@ -93,7 +95,7 @@ type historyTrapdatumR struct { func buildHistoryTrapdatumColumns(alias string) historyTrapdatumColumns { return historyTrapdatumColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "avetemp", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "field", "gatewaysync", "globalid", "idbytech", "locationname", "loc_id", "lr", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitecond", "sortbytech", "srid", "startdatetime", "trapactivitytype", "trapcondition", "trapnights", "traptype", "voltage", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "lure", "vectorsurvtrapdataid", "vectorsurvtraplocationid", "version", + "organization_id", "avetemp", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "field", "gatewaysync", "globalid", "idbytech", "locationname", "loc_id", "lr", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitecond", "sortbytech", "srid", "startdatetime", "trapactivitytype", "trapcondition", "trapnights", "traptype", "voltage", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "lure", "vectorsurvtrapdataid", "vectorsurvtraplocationid", "version", ).WithParent("history_trapdata"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -132,6 +134,7 @@ func buildHistoryTrapdatumColumns(alias string) historyTrapdatumColumns { Windspeed: psql.Quote(alias, "windspeed"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -184,6 +187,7 @@ type historyTrapdatumColumns struct { Windspeed psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -208,57 +212,58 @@ func (historyTrapdatumColumns) AliasedAs(alias string) historyTrapdatumColumns { // All values are optional, and do not have to be set // Generated columns are not included type HistoryTrapdatumSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Field omitnull.Val[int64] `db:"field" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Idbytech omitnull.Val[string] `db:"idbytech" ` - Locationname omitnull.Val[string] `db:"locationname" ` - LocID omitnull.Val[string] `db:"loc_id" ` - LR omitnull.Val[int16] `db:"lr" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Sortbytech omitnull.Val[string] `db:"sortbytech" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Trapactivitytype omitnull.Val[string] `db:"trapactivitytype" ` - Trapcondition omitnull.Val[string] `db:"trapcondition" ` - Trapnights omitnull.Val[int16] `db:"trapnights" ` - Traptype omitnull.Val[string] `db:"traptype" ` - Voltage omitnull.Val[float64] `db:"voltage" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Lure omitnull.Val[string] `db:"lure" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid omitnull.Val[string] `db:"vectorsurvtraplocationid" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Enddatetime omitnull.Val[int64] `db:"enddatetime" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Field omitnull.Val[int64] `db:"field" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Idbytech omitnull.Val[string] `db:"idbytech" ` + Locationname omitnull.Val[string] `db:"locationname" ` + LocID omitnull.Val[string] `db:"loc_id" ` + LR omitnull.Val[int16] `db:"lr" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Processed omitnull.Val[int16] `db:"processed" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[int64] `db:"revieweddate" ` + Sitecond omitnull.Val[string] `db:"sitecond" ` + Sortbytech omitnull.Val[string] `db:"sortbytech" ` + Srid omitnull.Val[string] `db:"srid" ` + Startdatetime omitnull.Val[int64] `db:"startdatetime" ` + Trapactivitytype omitnull.Val[string] `db:"trapactivitytype" ` + Trapcondition omitnull.Val[string] `db:"trapcondition" ` + Trapnights omitnull.Val[int16] `db:"trapnights" ` + Traptype omitnull.Val[string] `db:"traptype" ` + Voltage omitnull.Val[float64] `db:"voltage" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Lure omitnull.Val[string] `db:"lure" ` + Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` + Vectorsurvtraplocationid omitnull.Val[string] `db:"vectorsurvtraplocationid" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryTrapdatumSetter) SetColumns() []string { - vals := make([]string, 0, 46) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 47) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Avetemp.IsUnset() { @@ -366,6 +371,9 @@ func (s HistoryTrapdatumSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -400,8 +408,8 @@ func (s HistoryTrapdatumSetter) SetColumns() []string { } func (s HistoryTrapdatumSetter) Overwrite(t *HistoryTrapdatum) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Avetemp.IsUnset() { t.Avetemp = s.Avetemp.MustGetNull() @@ -508,6 +516,9 @@ func (s HistoryTrapdatumSetter) Overwrite(t *HistoryTrapdatum) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -546,9 +557,9 @@ func (s *HistoryTrapdatumSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 46) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 47) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -763,66 +774,72 @@ func (s *HistoryTrapdatumSetter) Apply(q *dialect.InsertQuery) { vals[35] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[36] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[36] = psql.Arg(s.Created.MustGetNull()) } else { vals[36] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[37] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[37] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[37] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[38] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[38] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[38] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[39] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[39] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[39] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[40] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[40] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[40] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[41] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[41] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[41] = psql.Raw("DEFAULT") } - if !s.Lure.IsUnset() { - vals[42] = psql.Arg(s.Lure.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[42] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[42] = psql.Raw("DEFAULT") } - if !s.Vectorsurvtrapdataid.IsUnset() { - vals[43] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) + if !s.Lure.IsUnset() { + vals[43] = psql.Arg(s.Lure.MustGetNull()) } else { vals[43] = psql.Raw("DEFAULT") } - if !s.Vectorsurvtraplocationid.IsUnset() { - vals[44] = psql.Arg(s.Vectorsurvtraplocationid.MustGetNull()) + if !s.Vectorsurvtrapdataid.IsUnset() { + vals[44] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) } else { vals[44] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[45] = psql.Arg(s.Version.MustGet()) + if !s.Vectorsurvtraplocationid.IsUnset() { + vals[45] = psql.Arg(s.Vectorsurvtraplocationid.MustGetNull()) } else { vals[45] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[46] = psql.Arg(s.Version.MustGet()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -832,9 +849,9 @@ func (s HistoryTrapdatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 46) + exprs := make([]bob.Expression, 0, 47) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1086,6 +1103,13 @@ func (s HistoryTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1400,7 +1424,7 @@ func (o *HistoryTrapdatum) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O } func (os HistoryTrapdatumSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1418,7 +1442,7 @@ func (os HistoryTrapdatumSlice) Organization(mods ...bob.Mod[*dialect.SelectQuer func attachHistoryTrapdatumOrganization0(ctx context.Context, exec bob.Executor, count int, historyTrapdatum0 *HistoryTrapdatum, organization1 *Organization) (*HistoryTrapdatum, error) { setter := &HistoryTrapdatumSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyTrapdatum0.Update(ctx, exec, setter) @@ -1465,7 +1489,7 @@ func (historyTrapdatum0 *HistoryTrapdatum) AttachOrganization(ctx context.Contex } type historyTrapdatumWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Avetemp psql.WhereNullMod[Q, float64] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] @@ -1501,6 +1525,7 @@ type historyTrapdatumWhere[Q psql.Filterable] struct { Windspeed psql.WhereNullMod[Q, float64] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1519,7 +1544,7 @@ func (historyTrapdatumWhere[Q]) AliasedAs(alias string) historyTrapdatumWhere[Q] func buildHistoryTrapdatumWhere[Q psql.Filterable](cols historyTrapdatumColumns) historyTrapdatumWhere[Q] { return historyTrapdatumWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), @@ -1555,6 +1580,7 @@ func buildHistoryTrapdatumWhere[Q psql.Filterable](cols historyTrapdatumColumns) Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1669,11 +1695,8 @@ func (os HistoryTrapdatumSlice) LoadOrganization(ctx context.Context, exec bob.E } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_traplocation.bob.go b/models/history_traplocation.bob.go index 48e86bb6..c6b4eadf 100644 --- a/models/history_traplocation.bob.go +++ b/models/history_traplocation.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,40 +26,41 @@ import ( // HistoryTraplocation is an object representing the database table. type HistoryTraplocation struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Usetype null.Val[string] `db:"usetype" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Route null.Val[int64] `db:"route" ` - RouteOrder null.Val[int64] `db:"route_order" ` - SetDow null.Val[int64] `db:"set_dow" ` - Vectorsurvsiteid null.Val[string] `db:"vectorsurvsiteid" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Accessdesc null.Val[string] `db:"accessdesc" ` + Active null.Val[int16] `db:"active" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Description null.Val[string] `db:"description" ` + Externalid null.Val[string] `db:"externalid" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + Globalid null.Val[string] `db:"globalid" ` + Habitat null.Val[string] `db:"habitat" ` + Locationnumber null.Val[int64] `db:"locationnumber" ` + Name null.Val[string] `db:"name" ` + Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` + Objectid int32 `db:"objectid,pk" ` + Priority null.Val[string] `db:"priority" ` + Usetype null.Val[string] `db:"usetype" ` + Zone null.Val[string] `db:"zone" ` + Zone2 null.Val[string] `db:"zone2" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Route null.Val[int64] `db:"route" ` + RouteOrder null.Val[int64] `db:"route_order" ` + SetDow null.Val[int64] `db:"set_dow" ` + Vectorsurvsiteid null.Val[string] `db:"vectorsurvsiteid" ` + H3R7 null.Val[string] `db:"h3r7" ` + H3R8 null.Val[string] `db:"h3r8" ` + Version int32 `db:"version,pk" ` R historyTraplocationR `db:"-" ` } @@ -81,7 +83,7 @@ type historyTraplocationR struct { func buildHistoryTraplocationColumns(alias string) historyTraplocationColumns { return historyTraplocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "route", "route_order", "set_dow", "vectorsurvsiteid", "h3r7", "h3r8", "version", + "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "route", "route_order", "set_dow", "vectorsurvsiteid", "h3r7", "h3r8", "version", ).WithParent("history_traplocation"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -105,6 +107,7 @@ func buildHistoryTraplocationColumns(alias string) historyTraplocationColumns { Usetype: psql.Quote(alias, "usetype"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -145,6 +148,7 @@ type historyTraplocationColumns struct { Usetype psql.Expression Zone psql.Expression Zone2 psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -172,45 +176,46 @@ func (historyTraplocationColumns) AliasedAs(alias string) historyTraplocationCol // All values are optional, and do not have to be set // Generated columns are not included type HistoryTraplocationSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Route omitnull.Val[int64] `db:"route" ` - RouteOrder omitnull.Val[int64] `db:"route_order" ` - SetDow omitnull.Val[int64] `db:"set_dow" ` - Vectorsurvsiteid omitnull.Val[string] `db:"vectorsurvsiteid" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Active omitnull.Val[int16] `db:"active" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Description omitnull.Val[string] `db:"description" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Locationnumber omitnull.Val[int64] `db:"locationnumber" ` + Name omitnull.Val[string] `db:"name" ` + Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Route omitnull.Val[int64] `db:"route" ` + RouteOrder omitnull.Val[int64] `db:"route_order" ` + SetDow omitnull.Val[int64] `db:"set_dow" ` + Vectorsurvsiteid omitnull.Val[string] `db:"vectorsurvsiteid" ` + H3R7 omitnull.Val[string] `db:"h3r7" ` + H3R8 omitnull.Val[string] `db:"h3r8" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryTraplocationSetter) SetColumns() []string { - vals := make([]string, 0, 34) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 35) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Accessdesc.IsUnset() { @@ -273,6 +278,9 @@ func (s HistoryTraplocationSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -316,8 +324,8 @@ func (s HistoryTraplocationSetter) SetColumns() []string { } func (s HistoryTraplocationSetter) Overwrite(t *HistoryTraplocation) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Accessdesc.IsUnset() { t.Accessdesc = s.Accessdesc.MustGetNull() @@ -379,6 +387,9 @@ func (s HistoryTraplocationSetter) Overwrite(t *HistoryTraplocation) { if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -426,9 +437,9 @@ func (s *HistoryTraplocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 34) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 35) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -553,84 +564,90 @@ func (s *HistoryTraplocationSetter) Apply(q *dialect.InsertQuery) { vals[20] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[21] = psql.Arg(s.Created.MustGetNull()) } else { vals[21] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[22] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[23] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[23] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[24] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[24] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[24] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[25] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[25] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[26] = psql.Raw("DEFAULT") } - if !s.Route.IsUnset() { - vals[27] = psql.Arg(s.Route.MustGetNull()) + if !s.LastEditedUser.IsUnset() { + vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[27] = psql.Raw("DEFAULT") } - if !s.RouteOrder.IsUnset() { - vals[28] = psql.Arg(s.RouteOrder.MustGetNull()) + if !s.Route.IsUnset() { + vals[28] = psql.Arg(s.Route.MustGetNull()) } else { vals[28] = psql.Raw("DEFAULT") } - if !s.SetDow.IsUnset() { - vals[29] = psql.Arg(s.SetDow.MustGetNull()) + if !s.RouteOrder.IsUnset() { + vals[29] = psql.Arg(s.RouteOrder.MustGetNull()) } else { vals[29] = psql.Raw("DEFAULT") } - if !s.Vectorsurvsiteid.IsUnset() { - vals[30] = psql.Arg(s.Vectorsurvsiteid.MustGetNull()) + if !s.SetDow.IsUnset() { + vals[30] = psql.Arg(s.SetDow.MustGetNull()) } else { vals[30] = psql.Raw("DEFAULT") } - if !s.H3R7.IsUnset() { - vals[31] = psql.Arg(s.H3R7.MustGetNull()) + if !s.Vectorsurvsiteid.IsUnset() { + vals[31] = psql.Arg(s.Vectorsurvsiteid.MustGetNull()) } else { vals[31] = psql.Raw("DEFAULT") } - if !s.H3R8.IsUnset() { - vals[32] = psql.Arg(s.H3R8.MustGetNull()) + if !s.H3R7.IsUnset() { + vals[32] = psql.Arg(s.H3R7.MustGetNull()) } else { vals[32] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[33] = psql.Arg(s.Version.MustGet()) + if !s.H3R8.IsUnset() { + vals[33] = psql.Arg(s.H3R8.MustGetNull()) } else { vals[33] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[34] = psql.Arg(s.Version.MustGet()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -640,9 +657,9 @@ func (s HistoryTraplocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryTraplocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 34) + exprs := make([]bob.Expression, 0, 35) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -789,6 +806,13 @@ func (s HistoryTraplocationSetter) Expressions(prefix ...string) []bob.Expressio }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -1124,7 +1148,7 @@ func (o *HistoryTraplocation) Organization(mods ...bob.Mod[*dialect.SelectQuery] } func (os HistoryTraplocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1142,7 +1166,7 @@ func (os HistoryTraplocationSlice) Organization(mods ...bob.Mod[*dialect.SelectQ func attachHistoryTraplocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyTraplocation0 *HistoryTraplocation, organization1 *Organization) (*HistoryTraplocation, error) { setter := &HistoryTraplocationSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyTraplocation0.Update(ctx, exec, setter) @@ -1189,7 +1213,7 @@ func (historyTraplocation0 *HistoryTraplocation) AttachOrganization(ctx context. } type historyTraplocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Accessdesc psql.WhereNullMod[Q, string] Active psql.WhereNullMod[Q, int16] Comments psql.WhereNullMod[Q, string] @@ -1210,6 +1234,7 @@ type historyTraplocationWhere[Q psql.Filterable] struct { Usetype psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -1231,7 +1256,7 @@ func (historyTraplocationWhere[Q]) AliasedAs(alias string) historyTraplocationWh func buildHistoryTraplocationWhere[Q psql.Filterable](cols historyTraplocationColumns) historyTraplocationWhere[Q] { return historyTraplocationWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Active: psql.WhereNull[Q, int16](cols.Active), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -1252,6 +1277,7 @@ func buildHistoryTraplocationWhere[Q psql.Filterable](cols historyTraplocationCo Usetype: psql.WhereNull[Q, string](cols.Usetype), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1369,11 +1395,8 @@ func (os HistoryTraplocationSlice) LoadOrganization(ctx context.Context, exec bo } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_treatment.bob.go b/models/history_treatment.bob.go index a4f23a01..2b030fac 100644 --- a/models/history_treatment.bob.go +++ b/models/history_treatment.bob.go @@ -25,7 +25,7 @@ import ( // HistoryTreatment is an object representing the database table. type HistoryTreatment struct { - OrganizationID null.Val[int32] `db:"organization_id" ` + OrganizationID int32 `db:"organization_id" ` Activity null.Val[string] `db:"activity" ` Areaunit null.Val[string] `db:"areaunit" ` Avetemp null.Val[float64] `db:"avetemp" ` @@ -244,7 +244,7 @@ func (historyTreatmentColumns) AliasedAs(alias string) historyTreatmentColumns { // All values are optional, and do not have to be set // Generated columns are not included type HistoryTreatmentSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` Activity omitnull.Val[string] `db:"activity" ` Areaunit omitnull.Val[string] `db:"areaunit" ` Avetemp omitnull.Val[float64] `db:"avetemp" ` @@ -306,7 +306,7 @@ type HistoryTreatmentSetter struct { func (s HistoryTreatmentSetter) SetColumns() []string { vals := make([]string, 0, 58) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Activity.IsUnset() { @@ -484,8 +484,8 @@ func (s HistoryTreatmentSetter) SetColumns() []string { } func (s HistoryTreatmentSetter) Overwrite(t *HistoryTreatment) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Activity.IsUnset() { t.Activity = s.Activity.MustGetNull() @@ -667,8 +667,8 @@ func (s *HistoryTreatmentSetter) Apply(q *dialect.InsertQuery) { q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { vals := make([]bob.Expression, 58) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -1026,7 +1026,7 @@ func (s HistoryTreatmentSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { func (s HistoryTreatmentSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 58) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -1676,7 +1676,7 @@ func (o *HistoryTreatment) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O } func (os HistoryTreatmentSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -1694,7 +1694,7 @@ func (os HistoryTreatmentSlice) Organization(mods ...bob.Mod[*dialect.SelectQuer func attachHistoryTreatmentOrganization0(ctx context.Context, exec bob.Executor, count int, historyTreatment0 *HistoryTreatment, organization1 *Organization) (*HistoryTreatment, error) { setter := &HistoryTreatmentSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyTreatment0.Update(ctx, exec, setter) @@ -1741,7 +1741,7 @@ func (historyTreatment0 *HistoryTreatment) AttachOrganization(ctx context.Contex } type historyTreatmentWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Activity psql.WhereNullMod[Q, string] Areaunit psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] @@ -1807,7 +1807,7 @@ func (historyTreatmentWhere[Q]) AliasedAs(alias string) historyTreatmentWhere[Q] func buildHistoryTreatmentWhere[Q psql.Filterable](cols historyTreatmentColumns) historyTreatmentWhere[Q] { return historyTreatmentWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Activity: psql.WhereNull[Q, string](cols.Activity), Areaunit: psql.WhereNull[Q, string](cols.Areaunit), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), @@ -1969,11 +1969,8 @@ func (os HistoryTreatmentSlice) LoadOrganization(ctx context.Context, exec bob.E } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_treatmentarea.bob.go b/models/history_treatmentarea.bob.go index 65e16442..fb72a96d 100644 --- a/models/history_treatmentarea.bob.go +++ b/models/history_treatmentarea.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,28 +26,29 @@ import ( // HistoryTreatmentarea is an object representing the database table. type HistoryTreatmentarea struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Notified null.Val[int16] `db:"notified" ` - Objectid int32 `db:"objectid,pk" ` - SessionID null.Val[string] `db:"session_id" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Treatdate null.Val[int64] `db:"treatdate" ` - TreatID null.Val[string] `db:"treat_id" ` - Type null.Val[string] `db:"type" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Comments null.Val[string] `db:"comments" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Notified null.Val[int16] `db:"notified" ` + Objectid int32 `db:"objectid,pk" ` + SessionID null.Val[string] `db:"session_id" ` + ShapeArea null.Val[float64] `db:"shape__area" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Treatdate null.Val[int64] `db:"treatdate" ` + TreatID null.Val[string] `db:"treat_id" ` + Type null.Val[string] `db:"type" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyTreatmentareaR `db:"-" ` } @@ -69,7 +71,7 @@ type historyTreatmentareaR struct { func buildHistoryTreatmentareaColumns(alias string) historyTreatmentareaColumns { return historyTreatmentareaColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "globalid", "notified", "objectid", "session_id", "shape__area", "shape__length", "treatdate", "treat_id", "type", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "globalid", "notified", "objectid", "session_id", "shape__area", "shape__length", "treatdate", "treat_id", "type", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_treatmentarea"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -87,6 +89,7 @@ func buildHistoryTreatmentareaColumns(alias string) historyTreatmentareaColumns Treatdate: psql.Quote(alias, "treatdate"), TreatID: psql.Quote(alias, "treat_id"), Type: psql.Quote(alias, "type"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -115,6 +118,7 @@ type historyTreatmentareaColumns struct { Treatdate psql.Expression TreatID psql.Expression Type psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -136,33 +140,34 @@ func (historyTreatmentareaColumns) AliasedAs(alias string) historyTreatmentareaC // All values are optional, and do not have to be set // Generated columns are not included type HistoryTreatmentareaSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Notified omitnull.Val[int16] `db:"notified" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - SessionID omitnull.Val[string] `db:"session_id" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Treatdate omitnull.Val[int64] `db:"treatdate" ` - TreatID omitnull.Val[string] `db:"treat_id" ` - Type omitnull.Val[string] `db:"type" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Comments omitnull.Val[string] `db:"comments" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Notified omitnull.Val[int16] `db:"notified" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + SessionID omitnull.Val[string] `db:"session_id" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Treatdate omitnull.Val[int64] `db:"treatdate" ` + TreatID omitnull.Val[string] `db:"treat_id" ` + Type omitnull.Val[string] `db:"type" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryTreatmentareaSetter) SetColumns() []string { - vals := make([]string, 0, 22) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 23) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Comments.IsUnset() { @@ -207,6 +212,9 @@ func (s HistoryTreatmentareaSetter) SetColumns() []string { if !s.Type.IsUnset() { vals = append(vals, "type") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -232,8 +240,8 @@ func (s HistoryTreatmentareaSetter) SetColumns() []string { } func (s HistoryTreatmentareaSetter) Overwrite(t *HistoryTreatmentarea) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Comments.IsUnset() { t.Comments = s.Comments.MustGetNull() @@ -277,6 +285,9 @@ func (s HistoryTreatmentareaSetter) Overwrite(t *HistoryTreatmentarea) { if !s.Type.IsUnset() { t.Type = s.Type.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -306,9 +317,9 @@ func (s *HistoryTreatmentareaSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 22) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 23) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -397,48 +408,54 @@ func (s *HistoryTreatmentareaSetter) Apply(q *dialect.InsertQuery) { vals[14] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[15] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[15] = psql.Arg(s.Created.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[16] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[16] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[17] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[17] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[17] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[18] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[18] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[18] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[19] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[19] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[19] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[20] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[20] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[20] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[21] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[21] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[21] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[22] = psql.Arg(s.Version.MustGet()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -448,9 +465,9 @@ func (s HistoryTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 22) + exprs := make([]bob.Expression, 0, 23) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -555,6 +572,13 @@ func (s HistoryTreatmentareaSetter) Expressions(prefix ...string) []bob.Expressi }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -848,7 +872,7 @@ func (o *HistoryTreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery } func (os HistoryTreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -866,7 +890,7 @@ func (os HistoryTreatmentareaSlice) Organization(mods ...bob.Mod[*dialect.Select func attachHistoryTreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, historyTreatmentarea0 *HistoryTreatmentarea, organization1 *Organization) (*HistoryTreatmentarea, error) { setter := &HistoryTreatmentareaSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyTreatmentarea0.Update(ctx, exec, setter) @@ -913,7 +937,7 @@ func (historyTreatmentarea0 *HistoryTreatmentarea) AttachOrganization(ctx contex } type historyTreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Comments psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -928,6 +952,7 @@ type historyTreatmentareaWhere[Q psql.Filterable] struct { Treatdate psql.WhereNullMod[Q, int64] TreatID psql.WhereNullMod[Q, string] Type psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -943,7 +968,7 @@ func (historyTreatmentareaWhere[Q]) AliasedAs(alias string) historyTreatmentarea func buildHistoryTreatmentareaWhere[Q psql.Filterable](cols historyTreatmentareaColumns) historyTreatmentareaWhere[Q] { return historyTreatmentareaWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Comments: psql.WhereNull[Q, string](cols.Comments), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -958,6 +983,7 @@ func buildHistoryTreatmentareaWhere[Q psql.Filterable](cols historyTreatmentarea Treatdate: psql.WhereNull[Q, int64](cols.Treatdate), TreatID: psql.WhereNull[Q, string](cols.TreatID), Type: psql.WhereNull[Q, string](cols.Type), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -1069,11 +1095,8 @@ func (os HistoryTreatmentareaSlice) LoadOrganization(ctx context.Context, exec b } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_zones.bob.go b/models/history_zones.bob.go index 499fb3a8..45d97961 100644 --- a/models/history_zones.bob.go +++ b/models/history_zones.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,24 +26,25 @@ import ( // HistoryZone is an object representing the database table. type HistoryZone struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Active null.Val[int64] `db:"active" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Active null.Val[int64] `db:"active" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Name null.Val[string] `db:"name" ` + Objectid int32 `db:"objectid,pk" ` + ShapeArea null.Val[float64] `db:"shape__area" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyZoneR `db:"-" ` } @@ -65,7 +67,7 @@ type historyZoneR struct { func buildHistoryZoneColumns(alias string) historyZoneColumns { return historyZoneColumns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "active", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "active", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_zones"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -79,6 +81,7 @@ func buildHistoryZoneColumns(alias string) historyZoneColumns { Objectid: psql.Quote(alias, "objectid"), ShapeArea: psql.Quote(alias, "shape__area"), ShapeLength: psql.Quote(alias, "shape__length"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -103,6 +106,7 @@ type historyZoneColumns struct { Objectid psql.Expression ShapeArea psql.Expression ShapeLength psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -124,29 +128,30 @@ func (historyZoneColumns) AliasedAs(alias string) historyZoneColumns { // All values are optional, and do not have to be set // Generated columns are not included type HistoryZoneSetter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Active omitnull.Val[int64] `db:"active" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Name omitnull.Val[string] `db:"name" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Active omitnull.Val[int64] `db:"active" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Name omitnull.Val[string] `db:"name" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryZoneSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 19) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Active.IsUnset() { @@ -179,6 +184,9 @@ func (s HistoryZoneSetter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -204,8 +212,8 @@ func (s HistoryZoneSetter) SetColumns() []string { } func (s HistoryZoneSetter) Overwrite(t *HistoryZone) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Active.IsUnset() { t.Active = s.Active.MustGetNull() @@ -237,6 +245,9 @@ func (s HistoryZoneSetter) Overwrite(t *HistoryZone) { if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -266,9 +277,9 @@ func (s *HistoryZoneSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 19) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -333,48 +344,54 @@ func (s *HistoryZoneSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[11] = psql.Arg(s.Created.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[14] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[15] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[17] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[17] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[18] = psql.Arg(s.Version.MustGet()) + } else { + vals[18] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -384,9 +401,9 @@ func (s HistoryZoneSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryZoneSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) + exprs := make([]bob.Expression, 0, 19) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -463,6 +480,13 @@ func (s HistoryZoneSetter) Expressions(prefix ...string) []bob.Expression { }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -756,7 +780,7 @@ func (o *HistoryZone) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organi } func (os HistoryZoneSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -774,7 +798,7 @@ func (os HistoryZoneSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) O func attachHistoryZoneOrganization0(ctx context.Context, exec bob.Executor, count int, historyZone0 *HistoryZone, organization1 *Organization) (*HistoryZone, error) { setter := &HistoryZoneSetter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyZone0.Update(ctx, exec, setter) @@ -821,7 +845,7 @@ func (historyZone0 *HistoryZone) AttachOrganization(ctx context.Context, exec bo } type historyZoneWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Active psql.WhereNullMod[Q, int64] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] @@ -832,6 +856,7 @@ type historyZoneWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int32] ShapeArea psql.WhereNullMod[Q, float64] ShapeLength psql.WhereNullMod[Q, float64] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -847,7 +872,7 @@ func (historyZoneWhere[Q]) AliasedAs(alias string) historyZoneWhere[Q] { func buildHistoryZoneWhere[Q psql.Filterable](cols historyZoneColumns) historyZoneWhere[Q] { return historyZoneWhere[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Active: psql.WhereNull[Q, int64](cols.Active), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -858,6 +883,7 @@ func buildHistoryZoneWhere[Q psql.Filterable](cols historyZoneColumns) historyZo Objectid: psql.Where[Q, int32](cols.Objectid), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -969,11 +995,8 @@ func (os HistoryZoneSlice) LoadOrganization(ctx context.Context, exec bob.Execut } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/history_zones2.bob.go b/models/history_zones2.bob.go index beb0a935..9cda48c2 100644 --- a/models/history_zones2.bob.go +++ b/models/history_zones2.bob.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "io" + "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" @@ -25,23 +26,24 @@ import ( // HistoryZones2 is an object representing the database table. type HistoryZones2 struct { - OrganizationID null.Val[int32] `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - CreatedDate null.Val[int64] `db:"created_date" ` - CreatedUser null.Val[string] `db:"created_user" ` - GeometryX null.Val[float64] `db:"geometry_x" ` - GeometryY null.Val[float64] `db:"geometry_y" ` - LastEditedDate null.Val[int64] `db:"last_edited_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + Creationdate null.Val[int64] `db:"creationdate" ` + Creator null.Val[string] `db:"creator" ` + Editdate null.Val[int64] `db:"editdate" ` + Editor null.Val[string] `db:"editor" ` + Globalid null.Val[string] `db:"globalid" ` + Name null.Val[string] `db:"name" ` + Objectid int32 `db:"objectid,pk" ` + ShapeArea null.Val[float64] `db:"shape__area" ` + ShapeLength null.Val[float64] `db:"shape__length" ` + Created null.Val[time.Time] `db:"created" ` + CreatedDate null.Val[int64] `db:"created_date" ` + CreatedUser null.Val[string] `db:"created_user" ` + GeometryX null.Val[float64] `db:"geometry_x" ` + GeometryY null.Val[float64] `db:"geometry_y" ` + LastEditedDate null.Val[int64] `db:"last_edited_date" ` + LastEditedUser null.Val[string] `db:"last_edited_user" ` + Version int32 `db:"version,pk" ` R historyZones2R `db:"-" ` } @@ -64,7 +66,7 @@ type historyZones2R struct { func buildHistoryZones2Columns(alias string) historyZones2Columns { return historyZones2Columns{ ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", + "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", ).WithParent("history_zones2"), tableAlias: alias, OrganizationID: psql.Quote(alias, "organization_id"), @@ -77,6 +79,7 @@ func buildHistoryZones2Columns(alias string) historyZones2Columns { Objectid: psql.Quote(alias, "objectid"), ShapeArea: psql.Quote(alias, "shape__area"), ShapeLength: psql.Quote(alias, "shape__length"), + Created: psql.Quote(alias, "created"), CreatedDate: psql.Quote(alias, "created_date"), CreatedUser: psql.Quote(alias, "created_user"), GeometryX: psql.Quote(alias, "geometry_x"), @@ -100,6 +103,7 @@ type historyZones2Columns struct { Objectid psql.Expression ShapeArea psql.Expression ShapeLength psql.Expression + Created psql.Expression CreatedDate psql.Expression CreatedUser psql.Expression GeometryX psql.Expression @@ -121,28 +125,29 @@ func (historyZones2Columns) AliasedAs(alias string) historyZones2Columns { // All values are optional, and do not have to be set // Generated columns are not included type HistoryZones2Setter struct { - OrganizationID omitnull.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Name omitnull.Val[string] `db:"name" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - CreatedDate omitnull.Val[int64] `db:"created_date" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - GeometryX omitnull.Val[float64] `db:"geometry_x" ` - GeometryY omitnull.Val[float64] `db:"geometry_y" ` - LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Creationdate omitnull.Val[int64] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[int64] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Globalid omitnull.Val[string] `db:"globalid" ` + Name omitnull.Val[string] `db:"name" ` + Objectid omit.Val[int32] `db:"objectid,pk" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Created omitnull.Val[time.Time] `db:"created" ` + CreatedDate omitnull.Val[int64] `db:"created_date" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + GeometryX omitnull.Val[float64] `db:"geometry_x" ` + GeometryY omitnull.Val[float64] `db:"geometry_y" ` + LastEditedDate omitnull.Val[int64] `db:"last_edited_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + Version omit.Val[int32] `db:"version,pk" ` } func (s HistoryZones2Setter) SetColumns() []string { - vals := make([]string, 0, 17) - if !s.OrganizationID.IsUnset() { + vals := make([]string, 0, 18) + if s.OrganizationID.IsValue() { vals = append(vals, "organization_id") } if !s.Creationdate.IsUnset() { @@ -172,6 +177,9 @@ func (s HistoryZones2Setter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if !s.Created.IsUnset() { + vals = append(vals, "created") + } if !s.CreatedDate.IsUnset() { vals = append(vals, "created_date") } @@ -197,8 +205,8 @@ func (s HistoryZones2Setter) SetColumns() []string { } func (s HistoryZones2Setter) Overwrite(t *HistoryZones2) { - if !s.OrganizationID.IsUnset() { - t.OrganizationID = s.OrganizationID.MustGetNull() + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() } if !s.Creationdate.IsUnset() { t.Creationdate = s.Creationdate.MustGetNull() @@ -227,6 +235,9 @@ func (s HistoryZones2Setter) Overwrite(t *HistoryZones2) { if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if !s.Created.IsUnset() { + t.Created = s.Created.MustGetNull() + } if !s.CreatedDate.IsUnset() { t.CreatedDate = s.CreatedDate.MustGetNull() } @@ -256,9 +267,9 @@ func (s *HistoryZones2Setter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 17) - if !s.OrganizationID.IsUnset() { - vals[0] = psql.Arg(s.OrganizationID.MustGetNull()) + vals := make([]bob.Expression, 18) + if s.OrganizationID.IsValue() { + vals[0] = psql.Arg(s.OrganizationID.MustGet()) } else { vals[0] = psql.Raw("DEFAULT") } @@ -317,48 +328,54 @@ func (s *HistoryZones2Setter) Apply(q *dialect.InsertQuery) { vals[9] = psql.Raw("DEFAULT") } - if !s.CreatedDate.IsUnset() { - vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) + if !s.Created.IsUnset() { + vals[10] = psql.Arg(s.Created.MustGetNull()) } else { vals[10] = psql.Raw("DEFAULT") } - if !s.CreatedUser.IsUnset() { - vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) + if !s.CreatedDate.IsUnset() { + vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) } else { vals[11] = psql.Raw("DEFAULT") } - if !s.GeometryX.IsUnset() { - vals[12] = psql.Arg(s.GeometryX.MustGetNull()) + if !s.CreatedUser.IsUnset() { + vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) } else { vals[12] = psql.Raw("DEFAULT") } - if !s.GeometryY.IsUnset() { - vals[13] = psql.Arg(s.GeometryY.MustGetNull()) + if !s.GeometryX.IsUnset() { + vals[13] = psql.Arg(s.GeometryX.MustGetNull()) } else { vals[13] = psql.Raw("DEFAULT") } - if !s.LastEditedDate.IsUnset() { - vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) + if !s.GeometryY.IsUnset() { + vals[14] = psql.Arg(s.GeometryY.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if !s.LastEditedUser.IsUnset() { - vals[15] = psql.Arg(s.LastEditedUser.MustGetNull()) + if !s.LastEditedDate.IsUnset() { + vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) } else { vals[15] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[16] = psql.Arg(s.Version.MustGet()) + if !s.LastEditedUser.IsUnset() { + vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } + if s.Version.IsValue() { + vals[17] = psql.Arg(s.Version.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -368,9 +385,9 @@ func (s HistoryZones2Setter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s HistoryZones2Setter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 17) + exprs := make([]bob.Expression, 0, 18) - if !s.OrganizationID.IsUnset() { + if s.OrganizationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "organization_id")...), psql.Arg(s.OrganizationID), @@ -440,6 +457,13 @@ func (s HistoryZones2Setter) Expressions(prefix ...string) []bob.Expression { }}) } + if !s.Created.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + if !s.CreatedDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "created_date")...), @@ -733,7 +757,7 @@ func (o *HistoryZones2) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Orga } func (os HistoryZones2Slice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + pkOrganizationID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { continue @@ -751,7 +775,7 @@ func (os HistoryZones2Slice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) func attachHistoryZones2Organization0(ctx context.Context, exec bob.Executor, count int, historyZones20 *HistoryZones2, organization1 *Organization) (*HistoryZones2, error) { setter := &HistoryZones2Setter{ - OrganizationID: omitnull.From(organization1.ID), + OrganizationID: omit.From(organization1.ID), } err := historyZones20.Update(ctx, exec, setter) @@ -798,7 +822,7 @@ func (historyZones20 *HistoryZones2) AttachOrganization(ctx context.Context, exe } type historyZones2Where[Q psql.Filterable] struct { - OrganizationID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] Creationdate psql.WhereNullMod[Q, int64] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, int64] @@ -808,6 +832,7 @@ type historyZones2Where[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int32] ShapeArea psql.WhereNullMod[Q, float64] ShapeLength psql.WhereNullMod[Q, float64] + Created psql.WhereNullMod[Q, time.Time] CreatedDate psql.WhereNullMod[Q, int64] CreatedUser psql.WhereNullMod[Q, string] GeometryX psql.WhereNullMod[Q, float64] @@ -823,7 +848,7 @@ func (historyZones2Where[Q]) AliasedAs(alias string) historyZones2Where[Q] { func buildHistoryZones2Where[Q psql.Filterable](cols historyZones2Columns) historyZones2Where[Q] { return historyZones2Where[Q]{ - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, int64](cols.Editdate), @@ -833,6 +858,7 @@ func buildHistoryZones2Where[Q psql.Filterable](cols historyZones2Columns) histo Objectid: psql.Where[Q, int32](cols.Objectid), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Created: psql.WhereNull[Q, time.Time](cols.Created), CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), @@ -944,11 +970,8 @@ func (os HistoryZones2Slice) LoadOrganization(ctx context.Context, exec bob.Exec } for _, rel := range organizations { - if !o.OrganizationID.IsValue() { - continue - } - if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) { + if !(o.OrganizationID == rel.ID) { continue } diff --git a/models/organization.bob.go b/models/organization.bob.go index 78b6e26b..6e4e255f 100644 --- a/models/organization.bob.go +++ b/models/organization.bob.go @@ -46,6 +46,7 @@ type OrganizationsQuery = *psql.ViewQuery[*Organization, OrganizationSlice] // organizationR is where relationships are stored. type organizationR struct { + FieldseekerSyncs FieldseekerSyncSlice // fieldseeker_sync.fieldseeker_sync_organization_id_fkey FSContainerrelates FSContainerrelateSlice // fs_containerrelate.fs_containerrelate_organization_id_fkey FSFieldscoutinglogs FSFieldscoutinglogSlice // fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey FSHabitatrelates FSHabitatrelateSlice // fs_habitatrelate.fs_habitatrelate_organization_id_fkey @@ -493,6 +494,30 @@ func (o OrganizationSlice) ReloadAll(ctx context.Context, exec bob.Executor) err return nil } +// FieldseekerSyncs starts a query for related objects on fieldseeker_sync +func (o *Organization) FieldseekerSyncs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSyncsQuery { + return FieldseekerSyncs.Query(append(mods, + sm.Where(FieldseekerSyncs.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) FieldseekerSyncs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSyncsQuery { + pkID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkID = append(pkID, o.ID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")), + )) + + return FieldseekerSyncs.Query(append(mods, + sm.Where(psql.Group(FieldseekerSyncs.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + // FSContainerrelates starts a query for related objects on fs_containerrelate func (o *Organization) FSContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSContainerrelatesQuery { return FSContainerrelates.Query(append(mods, @@ -1813,9 +1838,77 @@ func (os OrganizationSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQue )...) } +func insertOrganizationFieldseekerSyncs0(ctx context.Context, exec bob.Executor, fieldseekerSyncs1 []*FieldseekerSyncSetter, organization0 *Organization) (FieldseekerSyncSlice, error) { + for i := range fieldseekerSyncs1 { + fieldseekerSyncs1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerSyncs.Insert(bob.ToMods(fieldseekerSyncs1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFieldseekerSyncs0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFieldseekerSyncs0(ctx context.Context, exec bob.Executor, count int, fieldseekerSyncs1 FieldseekerSyncSlice, organization0 *Organization) (FieldseekerSyncSlice, error) { + setter := &FieldseekerSyncSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerSyncs1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFieldseekerSyncs0: %w", err) + } + + return fieldseekerSyncs1, nil +} + +func (organization0 *Organization) InsertFieldseekerSyncs(ctx context.Context, exec bob.Executor, related ...*FieldseekerSyncSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerSyncs1, err := insertOrganizationFieldseekerSyncs0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.FieldseekerSyncs = append(organization0.R.FieldseekerSyncs, fieldseekerSyncs1...) + + for _, rel := range fieldseekerSyncs1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFieldseekerSyncs(ctx context.Context, exec bob.Executor, related ...*FieldseekerSync) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerSyncs1 := FieldseekerSyncSlice(related) + + _, err = attachOrganizationFieldseekerSyncs0(ctx, exec, len(related), fieldseekerSyncs1, organization0) + if err != nil { + return err + } + + organization0.R.FieldseekerSyncs = append(organization0.R.FieldseekerSyncs, fieldseekerSyncs1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + func insertOrganizationFSContainerrelates0(ctx context.Context, exec bob.Executor, fsContainerrelates1 []*FSContainerrelateSetter, organization0 *Organization) (FSContainerrelateSlice, error) { for i := range fsContainerrelates1 { - fsContainerrelates1[i].OrganizationID = omitnull.From(organization0.ID) + fsContainerrelates1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSContainerrelates.Insert(bob.ToMods(fsContainerrelates1...)).All(ctx, exec) @@ -1828,7 +1921,7 @@ func insertOrganizationFSContainerrelates0(ctx context.Context, exec bob.Executo func attachOrganizationFSContainerrelates0(ctx context.Context, exec bob.Executor, count int, fsContainerrelates1 FSContainerrelateSlice, organization0 *Organization) (FSContainerrelateSlice, error) { setter := &FSContainerrelateSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsContainerrelates1.UpdateAll(ctx, exec, *setter) @@ -1883,7 +1976,7 @@ func (organization0 *Organization) AttachFSContainerrelates(ctx context.Context, func insertOrganizationFSFieldscoutinglogs0(ctx context.Context, exec bob.Executor, fsFieldscoutinglogs1 []*FSFieldscoutinglogSetter, organization0 *Organization) (FSFieldscoutinglogSlice, error) { for i := range fsFieldscoutinglogs1 { - fsFieldscoutinglogs1[i].OrganizationID = omitnull.From(organization0.ID) + fsFieldscoutinglogs1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSFieldscoutinglogs.Insert(bob.ToMods(fsFieldscoutinglogs1...)).All(ctx, exec) @@ -1896,7 +1989,7 @@ func insertOrganizationFSFieldscoutinglogs0(ctx context.Context, exec bob.Execut func attachOrganizationFSFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, fsFieldscoutinglogs1 FSFieldscoutinglogSlice, organization0 *Organization) (FSFieldscoutinglogSlice, error) { setter := &FSFieldscoutinglogSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsFieldscoutinglogs1.UpdateAll(ctx, exec, *setter) @@ -1951,7 +2044,7 @@ func (organization0 *Organization) AttachFSFieldscoutinglogs(ctx context.Context func insertOrganizationFSHabitatrelates0(ctx context.Context, exec bob.Executor, fsHabitatrelates1 []*FSHabitatrelateSetter, organization0 *Organization) (FSHabitatrelateSlice, error) { for i := range fsHabitatrelates1 { - fsHabitatrelates1[i].OrganizationID = omitnull.From(organization0.ID) + fsHabitatrelates1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSHabitatrelates.Insert(bob.ToMods(fsHabitatrelates1...)).All(ctx, exec) @@ -1964,7 +2057,7 @@ func insertOrganizationFSHabitatrelates0(ctx context.Context, exec bob.Executor, func attachOrganizationFSHabitatrelates0(ctx context.Context, exec bob.Executor, count int, fsHabitatrelates1 FSHabitatrelateSlice, organization0 *Organization) (FSHabitatrelateSlice, error) { setter := &FSHabitatrelateSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsHabitatrelates1.UpdateAll(ctx, exec, *setter) @@ -2019,7 +2112,7 @@ func (organization0 *Organization) AttachFSHabitatrelates(ctx context.Context, e func insertOrganizationFSInspectionsamples0(ctx context.Context, exec bob.Executor, fsInspectionsamples1 []*FSInspectionsampleSetter, organization0 *Organization) (FSInspectionsampleSlice, error) { for i := range fsInspectionsamples1 { - fsInspectionsamples1[i].OrganizationID = omitnull.From(organization0.ID) + fsInspectionsamples1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSInspectionsamples.Insert(bob.ToMods(fsInspectionsamples1...)).All(ctx, exec) @@ -2032,7 +2125,7 @@ func insertOrganizationFSInspectionsamples0(ctx context.Context, exec bob.Execut func attachOrganizationFSInspectionsamples0(ctx context.Context, exec bob.Executor, count int, fsInspectionsamples1 FSInspectionsampleSlice, organization0 *Organization) (FSInspectionsampleSlice, error) { setter := &FSInspectionsampleSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsInspectionsamples1.UpdateAll(ctx, exec, *setter) @@ -2087,7 +2180,7 @@ func (organization0 *Organization) AttachFSInspectionsamples(ctx context.Context func insertOrganizationFSInspectionsampledetails0(ctx context.Context, exec bob.Executor, fsInspectionsampledetails1 []*FSInspectionsampledetailSetter, organization0 *Organization) (FSInspectionsampledetailSlice, error) { for i := range fsInspectionsampledetails1 { - fsInspectionsampledetails1[i].OrganizationID = omitnull.From(organization0.ID) + fsInspectionsampledetails1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSInspectionsampledetails.Insert(bob.ToMods(fsInspectionsampledetails1...)).All(ctx, exec) @@ -2100,7 +2193,7 @@ func insertOrganizationFSInspectionsampledetails0(ctx context.Context, exec bob. func attachOrganizationFSInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, fsInspectionsampledetails1 FSInspectionsampledetailSlice, organization0 *Organization) (FSInspectionsampledetailSlice, error) { setter := &FSInspectionsampledetailSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsInspectionsampledetails1.UpdateAll(ctx, exec, *setter) @@ -2155,7 +2248,7 @@ func (organization0 *Organization) AttachFSInspectionsampledetails(ctx context.C func insertOrganizationFSLinelocations0(ctx context.Context, exec bob.Executor, fsLinelocations1 []*FSLinelocationSetter, organization0 *Organization) (FSLinelocationSlice, error) { for i := range fsLinelocations1 { - fsLinelocations1[i].OrganizationID = omitnull.From(organization0.ID) + fsLinelocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSLinelocations.Insert(bob.ToMods(fsLinelocations1...)).All(ctx, exec) @@ -2168,7 +2261,7 @@ func insertOrganizationFSLinelocations0(ctx context.Context, exec bob.Executor, func attachOrganizationFSLinelocations0(ctx context.Context, exec bob.Executor, count int, fsLinelocations1 FSLinelocationSlice, organization0 *Organization) (FSLinelocationSlice, error) { setter := &FSLinelocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsLinelocations1.UpdateAll(ctx, exec, *setter) @@ -2223,7 +2316,7 @@ func (organization0 *Organization) AttachFSLinelocations(ctx context.Context, ex func insertOrganizationFSLocationtrackings0(ctx context.Context, exec bob.Executor, fsLocationtrackings1 []*FSLocationtrackingSetter, organization0 *Organization) (FSLocationtrackingSlice, error) { for i := range fsLocationtrackings1 { - fsLocationtrackings1[i].OrganizationID = omitnull.From(organization0.ID) + fsLocationtrackings1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSLocationtrackings.Insert(bob.ToMods(fsLocationtrackings1...)).All(ctx, exec) @@ -2236,7 +2329,7 @@ func insertOrganizationFSLocationtrackings0(ctx context.Context, exec bob.Execut func attachOrganizationFSLocationtrackings0(ctx context.Context, exec bob.Executor, count int, fsLocationtrackings1 FSLocationtrackingSlice, organization0 *Organization) (FSLocationtrackingSlice, error) { setter := &FSLocationtrackingSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsLocationtrackings1.UpdateAll(ctx, exec, *setter) @@ -2291,7 +2384,7 @@ func (organization0 *Organization) AttachFSLocationtrackings(ctx context.Context func insertOrganizationFSMosquitoinspections0(ctx context.Context, exec bob.Executor, fsMosquitoinspections1 []*FSMosquitoinspectionSetter, organization0 *Organization) (FSMosquitoinspectionSlice, error) { for i := range fsMosquitoinspections1 { - fsMosquitoinspections1[i].OrganizationID = omitnull.From(organization0.ID) + fsMosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSMosquitoinspections.Insert(bob.ToMods(fsMosquitoinspections1...)).All(ctx, exec) @@ -2304,7 +2397,7 @@ func insertOrganizationFSMosquitoinspections0(ctx context.Context, exec bob.Exec func attachOrganizationFSMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fsMosquitoinspections1 FSMosquitoinspectionSlice, organization0 *Organization) (FSMosquitoinspectionSlice, error) { setter := &FSMosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsMosquitoinspections1.UpdateAll(ctx, exec, *setter) @@ -2359,7 +2452,7 @@ func (organization0 *Organization) AttachFSMosquitoinspections(ctx context.Conte func insertOrganizationFSPointlocations0(ctx context.Context, exec bob.Executor, fsPointlocations1 []*FSPointlocationSetter, organization0 *Organization) (FSPointlocationSlice, error) { for i := range fsPointlocations1 { - fsPointlocations1[i].OrganizationID = omitnull.From(organization0.ID) + fsPointlocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSPointlocations.Insert(bob.ToMods(fsPointlocations1...)).All(ctx, exec) @@ -2372,7 +2465,7 @@ func insertOrganizationFSPointlocations0(ctx context.Context, exec bob.Executor, func attachOrganizationFSPointlocations0(ctx context.Context, exec bob.Executor, count int, fsPointlocations1 FSPointlocationSlice, organization0 *Organization) (FSPointlocationSlice, error) { setter := &FSPointlocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsPointlocations1.UpdateAll(ctx, exec, *setter) @@ -2427,7 +2520,7 @@ func (organization0 *Organization) AttachFSPointlocations(ctx context.Context, e func insertOrganizationFSPolygonlocations0(ctx context.Context, exec bob.Executor, fsPolygonlocations1 []*FSPolygonlocationSetter, organization0 *Organization) (FSPolygonlocationSlice, error) { for i := range fsPolygonlocations1 { - fsPolygonlocations1[i].OrganizationID = omitnull.From(organization0.ID) + fsPolygonlocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSPolygonlocations.Insert(bob.ToMods(fsPolygonlocations1...)).All(ctx, exec) @@ -2440,7 +2533,7 @@ func insertOrganizationFSPolygonlocations0(ctx context.Context, exec bob.Executo func attachOrganizationFSPolygonlocations0(ctx context.Context, exec bob.Executor, count int, fsPolygonlocations1 FSPolygonlocationSlice, organization0 *Organization) (FSPolygonlocationSlice, error) { setter := &FSPolygonlocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsPolygonlocations1.UpdateAll(ctx, exec, *setter) @@ -2495,7 +2588,7 @@ func (organization0 *Organization) AttachFSPolygonlocations(ctx context.Context, func insertOrganizationFSPools0(ctx context.Context, exec bob.Executor, fsPools1 []*FSPoolSetter, organization0 *Organization) (FSPoolSlice, error) { for i := range fsPools1 { - fsPools1[i].OrganizationID = omitnull.From(organization0.ID) + fsPools1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSPools.Insert(bob.ToMods(fsPools1...)).All(ctx, exec) @@ -2508,7 +2601,7 @@ func insertOrganizationFSPools0(ctx context.Context, exec bob.Executor, fsPools1 func attachOrganizationFSPools0(ctx context.Context, exec bob.Executor, count int, fsPools1 FSPoolSlice, organization0 *Organization) (FSPoolSlice, error) { setter := &FSPoolSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsPools1.UpdateAll(ctx, exec, *setter) @@ -2563,7 +2656,7 @@ func (organization0 *Organization) AttachFSPools(ctx context.Context, exec bob.E func insertOrganizationFSPooldetails0(ctx context.Context, exec bob.Executor, fsPooldetails1 []*FSPooldetailSetter, organization0 *Organization) (FSPooldetailSlice, error) { for i := range fsPooldetails1 { - fsPooldetails1[i].OrganizationID = omitnull.From(organization0.ID) + fsPooldetails1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSPooldetails.Insert(bob.ToMods(fsPooldetails1...)).All(ctx, exec) @@ -2576,7 +2669,7 @@ func insertOrganizationFSPooldetails0(ctx context.Context, exec bob.Executor, fs func attachOrganizationFSPooldetails0(ctx context.Context, exec bob.Executor, count int, fsPooldetails1 FSPooldetailSlice, organization0 *Organization) (FSPooldetailSlice, error) { setter := &FSPooldetailSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsPooldetails1.UpdateAll(ctx, exec, *setter) @@ -2631,7 +2724,7 @@ func (organization0 *Organization) AttachFSPooldetails(ctx context.Context, exec func insertOrganizationFSProposedtreatmentareas0(ctx context.Context, exec bob.Executor, fsProposedtreatmentareas1 []*FSProposedtreatmentareaSetter, organization0 *Organization) (FSProposedtreatmentareaSlice, error) { for i := range fsProposedtreatmentareas1 { - fsProposedtreatmentareas1[i].OrganizationID = omitnull.From(organization0.ID) + fsProposedtreatmentareas1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSProposedtreatmentareas.Insert(bob.ToMods(fsProposedtreatmentareas1...)).All(ctx, exec) @@ -2644,7 +2737,7 @@ func insertOrganizationFSProposedtreatmentareas0(ctx context.Context, exec bob.E func attachOrganizationFSProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, fsProposedtreatmentareas1 FSProposedtreatmentareaSlice, organization0 *Organization) (FSProposedtreatmentareaSlice, error) { setter := &FSProposedtreatmentareaSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsProposedtreatmentareas1.UpdateAll(ctx, exec, *setter) @@ -2699,7 +2792,7 @@ func (organization0 *Organization) AttachFSProposedtreatmentareas(ctx context.Co func insertOrganizationFSQamosquitoinspections0(ctx context.Context, exec bob.Executor, fsQamosquitoinspections1 []*FSQamosquitoinspectionSetter, organization0 *Organization) (FSQamosquitoinspectionSlice, error) { for i := range fsQamosquitoinspections1 { - fsQamosquitoinspections1[i].OrganizationID = omitnull.From(organization0.ID) + fsQamosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSQamosquitoinspections.Insert(bob.ToMods(fsQamosquitoinspections1...)).All(ctx, exec) @@ -2712,7 +2805,7 @@ func insertOrganizationFSQamosquitoinspections0(ctx context.Context, exec bob.Ex func attachOrganizationFSQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fsQamosquitoinspections1 FSQamosquitoinspectionSlice, organization0 *Organization) (FSQamosquitoinspectionSlice, error) { setter := &FSQamosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsQamosquitoinspections1.UpdateAll(ctx, exec, *setter) @@ -2767,7 +2860,7 @@ func (organization0 *Organization) AttachFSQamosquitoinspections(ctx context.Con func insertOrganizationFSRodentlocations0(ctx context.Context, exec bob.Executor, fsRodentlocations1 []*FSRodentlocationSetter, organization0 *Organization) (FSRodentlocationSlice, error) { for i := range fsRodentlocations1 { - fsRodentlocations1[i].OrganizationID = omitnull.From(organization0.ID) + fsRodentlocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSRodentlocations.Insert(bob.ToMods(fsRodentlocations1...)).All(ctx, exec) @@ -2780,7 +2873,7 @@ func insertOrganizationFSRodentlocations0(ctx context.Context, exec bob.Executor func attachOrganizationFSRodentlocations0(ctx context.Context, exec bob.Executor, count int, fsRodentlocations1 FSRodentlocationSlice, organization0 *Organization) (FSRodentlocationSlice, error) { setter := &FSRodentlocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsRodentlocations1.UpdateAll(ctx, exec, *setter) @@ -2835,7 +2928,7 @@ func (organization0 *Organization) AttachFSRodentlocations(ctx context.Context, func insertOrganizationFSSamplecollections0(ctx context.Context, exec bob.Executor, fsSamplecollections1 []*FSSamplecollectionSetter, organization0 *Organization) (FSSamplecollectionSlice, error) { for i := range fsSamplecollections1 { - fsSamplecollections1[i].OrganizationID = omitnull.From(organization0.ID) + fsSamplecollections1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSSamplecollections.Insert(bob.ToMods(fsSamplecollections1...)).All(ctx, exec) @@ -2848,7 +2941,7 @@ func insertOrganizationFSSamplecollections0(ctx context.Context, exec bob.Execut func attachOrganizationFSSamplecollections0(ctx context.Context, exec bob.Executor, count int, fsSamplecollections1 FSSamplecollectionSlice, organization0 *Organization) (FSSamplecollectionSlice, error) { setter := &FSSamplecollectionSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsSamplecollections1.UpdateAll(ctx, exec, *setter) @@ -2903,7 +2996,7 @@ func (organization0 *Organization) AttachFSSamplecollections(ctx context.Context func insertOrganizationFSSamplelocations0(ctx context.Context, exec bob.Executor, fsSamplelocations1 []*FSSamplelocationSetter, organization0 *Organization) (FSSamplelocationSlice, error) { for i := range fsSamplelocations1 { - fsSamplelocations1[i].OrganizationID = omitnull.From(organization0.ID) + fsSamplelocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSSamplelocations.Insert(bob.ToMods(fsSamplelocations1...)).All(ctx, exec) @@ -2916,7 +3009,7 @@ func insertOrganizationFSSamplelocations0(ctx context.Context, exec bob.Executor func attachOrganizationFSSamplelocations0(ctx context.Context, exec bob.Executor, count int, fsSamplelocations1 FSSamplelocationSlice, organization0 *Organization) (FSSamplelocationSlice, error) { setter := &FSSamplelocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsSamplelocations1.UpdateAll(ctx, exec, *setter) @@ -2971,7 +3064,7 @@ func (organization0 *Organization) AttachFSSamplelocations(ctx context.Context, func insertOrganizationFSServicerequests0(ctx context.Context, exec bob.Executor, fsServicerequests1 []*FSServicerequestSetter, organization0 *Organization) (FSServicerequestSlice, error) { for i := range fsServicerequests1 { - fsServicerequests1[i].OrganizationID = omitnull.From(organization0.ID) + fsServicerequests1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSServicerequests.Insert(bob.ToMods(fsServicerequests1...)).All(ctx, exec) @@ -2984,7 +3077,7 @@ func insertOrganizationFSServicerequests0(ctx context.Context, exec bob.Executor func attachOrganizationFSServicerequests0(ctx context.Context, exec bob.Executor, count int, fsServicerequests1 FSServicerequestSlice, organization0 *Organization) (FSServicerequestSlice, error) { setter := &FSServicerequestSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsServicerequests1.UpdateAll(ctx, exec, *setter) @@ -3039,7 +3132,7 @@ func (organization0 *Organization) AttachFSServicerequests(ctx context.Context, func insertOrganizationFSSpeciesabundances0(ctx context.Context, exec bob.Executor, fsSpeciesabundances1 []*FSSpeciesabundanceSetter, organization0 *Organization) (FSSpeciesabundanceSlice, error) { for i := range fsSpeciesabundances1 { - fsSpeciesabundances1[i].OrganizationID = omitnull.From(organization0.ID) + fsSpeciesabundances1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSSpeciesabundances.Insert(bob.ToMods(fsSpeciesabundances1...)).All(ctx, exec) @@ -3052,7 +3145,7 @@ func insertOrganizationFSSpeciesabundances0(ctx context.Context, exec bob.Execut func attachOrganizationFSSpeciesabundances0(ctx context.Context, exec bob.Executor, count int, fsSpeciesabundances1 FSSpeciesabundanceSlice, organization0 *Organization) (FSSpeciesabundanceSlice, error) { setter := &FSSpeciesabundanceSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsSpeciesabundances1.UpdateAll(ctx, exec, *setter) @@ -3107,7 +3200,7 @@ func (organization0 *Organization) AttachFSSpeciesabundances(ctx context.Context func insertOrganizationFSStormdrains0(ctx context.Context, exec bob.Executor, fsStormdrains1 []*FSStormdrainSetter, organization0 *Organization) (FSStormdrainSlice, error) { for i := range fsStormdrains1 { - fsStormdrains1[i].OrganizationID = omitnull.From(organization0.ID) + fsStormdrains1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSStormdrains.Insert(bob.ToMods(fsStormdrains1...)).All(ctx, exec) @@ -3120,7 +3213,7 @@ func insertOrganizationFSStormdrains0(ctx context.Context, exec bob.Executor, fs func attachOrganizationFSStormdrains0(ctx context.Context, exec bob.Executor, count int, fsStormdrains1 FSStormdrainSlice, organization0 *Organization) (FSStormdrainSlice, error) { setter := &FSStormdrainSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsStormdrains1.UpdateAll(ctx, exec, *setter) @@ -3175,7 +3268,7 @@ func (organization0 *Organization) AttachFSStormdrains(ctx context.Context, exec func insertOrganizationFSTimecards0(ctx context.Context, exec bob.Executor, fsTimecards1 []*FSTimecardSetter, organization0 *Organization) (FSTimecardSlice, error) { for i := range fsTimecards1 { - fsTimecards1[i].OrganizationID = omitnull.From(organization0.ID) + fsTimecards1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSTimecards.Insert(bob.ToMods(fsTimecards1...)).All(ctx, exec) @@ -3188,7 +3281,7 @@ func insertOrganizationFSTimecards0(ctx context.Context, exec bob.Executor, fsTi func attachOrganizationFSTimecards0(ctx context.Context, exec bob.Executor, count int, fsTimecards1 FSTimecardSlice, organization0 *Organization) (FSTimecardSlice, error) { setter := &FSTimecardSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsTimecards1.UpdateAll(ctx, exec, *setter) @@ -3243,7 +3336,7 @@ func (organization0 *Organization) AttachFSTimecards(ctx context.Context, exec b func insertOrganizationFSTrapdata0(ctx context.Context, exec bob.Executor, fsTrapdata1 []*FSTrapdatumSetter, organization0 *Organization) (FSTrapdatumSlice, error) { for i := range fsTrapdata1 { - fsTrapdata1[i].OrganizationID = omitnull.From(organization0.ID) + fsTrapdata1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSTrapdata.Insert(bob.ToMods(fsTrapdata1...)).All(ctx, exec) @@ -3256,7 +3349,7 @@ func insertOrganizationFSTrapdata0(ctx context.Context, exec bob.Executor, fsTra func attachOrganizationFSTrapdata0(ctx context.Context, exec bob.Executor, count int, fsTrapdata1 FSTrapdatumSlice, organization0 *Organization) (FSTrapdatumSlice, error) { setter := &FSTrapdatumSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsTrapdata1.UpdateAll(ctx, exec, *setter) @@ -3311,7 +3404,7 @@ func (organization0 *Organization) AttachFSTrapdata(ctx context.Context, exec bo func insertOrganizationFSTraplocations0(ctx context.Context, exec bob.Executor, fsTraplocations1 []*FSTraplocationSetter, organization0 *Organization) (FSTraplocationSlice, error) { for i := range fsTraplocations1 { - fsTraplocations1[i].OrganizationID = omitnull.From(organization0.ID) + fsTraplocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSTraplocations.Insert(bob.ToMods(fsTraplocations1...)).All(ctx, exec) @@ -3324,7 +3417,7 @@ func insertOrganizationFSTraplocations0(ctx context.Context, exec bob.Executor, func attachOrganizationFSTraplocations0(ctx context.Context, exec bob.Executor, count int, fsTraplocations1 FSTraplocationSlice, organization0 *Organization) (FSTraplocationSlice, error) { setter := &FSTraplocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsTraplocations1.UpdateAll(ctx, exec, *setter) @@ -3379,7 +3472,7 @@ func (organization0 *Organization) AttachFSTraplocations(ctx context.Context, ex func insertOrganizationFSTreatments0(ctx context.Context, exec bob.Executor, fsTreatments1 []*FSTreatmentSetter, organization0 *Organization) (FSTreatmentSlice, error) { for i := range fsTreatments1 { - fsTreatments1[i].OrganizationID = omitnull.From(organization0.ID) + fsTreatments1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSTreatments.Insert(bob.ToMods(fsTreatments1...)).All(ctx, exec) @@ -3392,7 +3485,7 @@ func insertOrganizationFSTreatments0(ctx context.Context, exec bob.Executor, fsT func attachOrganizationFSTreatments0(ctx context.Context, exec bob.Executor, count int, fsTreatments1 FSTreatmentSlice, organization0 *Organization) (FSTreatmentSlice, error) { setter := &FSTreatmentSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsTreatments1.UpdateAll(ctx, exec, *setter) @@ -3447,7 +3540,7 @@ func (organization0 *Organization) AttachFSTreatments(ctx context.Context, exec func insertOrganizationFSTreatmentareas0(ctx context.Context, exec bob.Executor, fsTreatmentareas1 []*FSTreatmentareaSetter, organization0 *Organization) (FSTreatmentareaSlice, error) { for i := range fsTreatmentareas1 { - fsTreatmentareas1[i].OrganizationID = omitnull.From(organization0.ID) + fsTreatmentareas1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSTreatmentareas.Insert(bob.ToMods(fsTreatmentareas1...)).All(ctx, exec) @@ -3460,7 +3553,7 @@ func insertOrganizationFSTreatmentareas0(ctx context.Context, exec bob.Executor, func attachOrganizationFSTreatmentareas0(ctx context.Context, exec bob.Executor, count int, fsTreatmentareas1 FSTreatmentareaSlice, organization0 *Organization) (FSTreatmentareaSlice, error) { setter := &FSTreatmentareaSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsTreatmentareas1.UpdateAll(ctx, exec, *setter) @@ -3515,7 +3608,7 @@ func (organization0 *Organization) AttachFSTreatmentareas(ctx context.Context, e func insertOrganizationFSZones0(ctx context.Context, exec bob.Executor, fsZones1 []*FSZoneSetter, organization0 *Organization) (FSZoneSlice, error) { for i := range fsZones1 { - fsZones1[i].OrganizationID = omitnull.From(organization0.ID) + fsZones1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSZones.Insert(bob.ToMods(fsZones1...)).All(ctx, exec) @@ -3528,7 +3621,7 @@ func insertOrganizationFSZones0(ctx context.Context, exec bob.Executor, fsZones1 func attachOrganizationFSZones0(ctx context.Context, exec bob.Executor, count int, fsZones1 FSZoneSlice, organization0 *Organization) (FSZoneSlice, error) { setter := &FSZoneSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsZones1.UpdateAll(ctx, exec, *setter) @@ -3583,7 +3676,7 @@ func (organization0 *Organization) AttachFSZones(ctx context.Context, exec bob.E func insertOrganizationFSZones2s0(ctx context.Context, exec bob.Executor, fsZones2s1 []*FSZones2Setter, organization0 *Organization) (FSZones2Slice, error) { for i := range fsZones2s1 { - fsZones2s1[i].OrganizationID = omitnull.From(organization0.ID) + fsZones2s1[i].OrganizationID = omit.From(organization0.ID) } ret, err := FSZones2s.Insert(bob.ToMods(fsZones2s1...)).All(ctx, exec) @@ -3596,7 +3689,7 @@ func insertOrganizationFSZones2s0(ctx context.Context, exec bob.Executor, fsZone func attachOrganizationFSZones2s0(ctx context.Context, exec bob.Executor, count int, fsZones2s1 FSZones2Slice, organization0 *Organization) (FSZones2Slice, error) { setter := &FSZones2Setter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := fsZones2s1.UpdateAll(ctx, exec, *setter) @@ -3651,7 +3744,7 @@ func (organization0 *Organization) AttachFSZones2s(ctx context.Context, exec bob func insertOrganizationHistoryContainerrelates0(ctx context.Context, exec bob.Executor, historyContainerrelates1 []*HistoryContainerrelateSetter, organization0 *Organization) (HistoryContainerrelateSlice, error) { for i := range historyContainerrelates1 { - historyContainerrelates1[i].OrganizationID = omitnull.From(organization0.ID) + historyContainerrelates1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryContainerrelates.Insert(bob.ToMods(historyContainerrelates1...)).All(ctx, exec) @@ -3664,7 +3757,7 @@ func insertOrganizationHistoryContainerrelates0(ctx context.Context, exec bob.Ex func attachOrganizationHistoryContainerrelates0(ctx context.Context, exec bob.Executor, count int, historyContainerrelates1 HistoryContainerrelateSlice, organization0 *Organization) (HistoryContainerrelateSlice, error) { setter := &HistoryContainerrelateSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyContainerrelates1.UpdateAll(ctx, exec, *setter) @@ -3719,7 +3812,7 @@ func (organization0 *Organization) AttachHistoryContainerrelates(ctx context.Con func insertOrganizationHistoryFieldscoutinglogs0(ctx context.Context, exec bob.Executor, historyFieldscoutinglogs1 []*HistoryFieldscoutinglogSetter, organization0 *Organization) (HistoryFieldscoutinglogSlice, error) { for i := range historyFieldscoutinglogs1 { - historyFieldscoutinglogs1[i].OrganizationID = omitnull.From(organization0.ID) + historyFieldscoutinglogs1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryFieldscoutinglogs.Insert(bob.ToMods(historyFieldscoutinglogs1...)).All(ctx, exec) @@ -3732,7 +3825,7 @@ func insertOrganizationHistoryFieldscoutinglogs0(ctx context.Context, exec bob.E func attachOrganizationHistoryFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, historyFieldscoutinglogs1 HistoryFieldscoutinglogSlice, organization0 *Organization) (HistoryFieldscoutinglogSlice, error) { setter := &HistoryFieldscoutinglogSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyFieldscoutinglogs1.UpdateAll(ctx, exec, *setter) @@ -3787,7 +3880,7 @@ func (organization0 *Organization) AttachHistoryFieldscoutinglogs(ctx context.Co func insertOrganizationHistoryHabitatrelates0(ctx context.Context, exec bob.Executor, historyHabitatrelates1 []*HistoryHabitatrelateSetter, organization0 *Organization) (HistoryHabitatrelateSlice, error) { for i := range historyHabitatrelates1 { - historyHabitatrelates1[i].OrganizationID = omitnull.From(organization0.ID) + historyHabitatrelates1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryHabitatrelates.Insert(bob.ToMods(historyHabitatrelates1...)).All(ctx, exec) @@ -3800,7 +3893,7 @@ func insertOrganizationHistoryHabitatrelates0(ctx context.Context, exec bob.Exec func attachOrganizationHistoryHabitatrelates0(ctx context.Context, exec bob.Executor, count int, historyHabitatrelates1 HistoryHabitatrelateSlice, organization0 *Organization) (HistoryHabitatrelateSlice, error) { setter := &HistoryHabitatrelateSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyHabitatrelates1.UpdateAll(ctx, exec, *setter) @@ -3855,7 +3948,7 @@ func (organization0 *Organization) AttachHistoryHabitatrelates(ctx context.Conte func insertOrganizationHistoryInspectionsamples0(ctx context.Context, exec bob.Executor, historyInspectionsamples1 []*HistoryInspectionsampleSetter, organization0 *Organization) (HistoryInspectionsampleSlice, error) { for i := range historyInspectionsamples1 { - historyInspectionsamples1[i].OrganizationID = omitnull.From(organization0.ID) + historyInspectionsamples1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryInspectionsamples.Insert(bob.ToMods(historyInspectionsamples1...)).All(ctx, exec) @@ -3868,7 +3961,7 @@ func insertOrganizationHistoryInspectionsamples0(ctx context.Context, exec bob.E func attachOrganizationHistoryInspectionsamples0(ctx context.Context, exec bob.Executor, count int, historyInspectionsamples1 HistoryInspectionsampleSlice, organization0 *Organization) (HistoryInspectionsampleSlice, error) { setter := &HistoryInspectionsampleSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyInspectionsamples1.UpdateAll(ctx, exec, *setter) @@ -3923,7 +4016,7 @@ func (organization0 *Organization) AttachHistoryInspectionsamples(ctx context.Co func insertOrganizationHistoryInspectionsampledetails0(ctx context.Context, exec bob.Executor, historyInspectionsampledetails1 []*HistoryInspectionsampledetailSetter, organization0 *Organization) (HistoryInspectionsampledetailSlice, error) { for i := range historyInspectionsampledetails1 { - historyInspectionsampledetails1[i].OrganizationID = omitnull.From(organization0.ID) + historyInspectionsampledetails1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryInspectionsampledetails.Insert(bob.ToMods(historyInspectionsampledetails1...)).All(ctx, exec) @@ -3936,7 +4029,7 @@ func insertOrganizationHistoryInspectionsampledetails0(ctx context.Context, exec func attachOrganizationHistoryInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, historyInspectionsampledetails1 HistoryInspectionsampledetailSlice, organization0 *Organization) (HistoryInspectionsampledetailSlice, error) { setter := &HistoryInspectionsampledetailSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyInspectionsampledetails1.UpdateAll(ctx, exec, *setter) @@ -3991,7 +4084,7 @@ func (organization0 *Organization) AttachHistoryInspectionsampledetails(ctx cont func insertOrganizationHistoryLinelocations0(ctx context.Context, exec bob.Executor, historyLinelocations1 []*HistoryLinelocationSetter, organization0 *Organization) (HistoryLinelocationSlice, error) { for i := range historyLinelocations1 { - historyLinelocations1[i].OrganizationID = omitnull.From(organization0.ID) + historyLinelocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryLinelocations.Insert(bob.ToMods(historyLinelocations1...)).All(ctx, exec) @@ -4004,7 +4097,7 @@ func insertOrganizationHistoryLinelocations0(ctx context.Context, exec bob.Execu func attachOrganizationHistoryLinelocations0(ctx context.Context, exec bob.Executor, count int, historyLinelocations1 HistoryLinelocationSlice, organization0 *Organization) (HistoryLinelocationSlice, error) { setter := &HistoryLinelocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyLinelocations1.UpdateAll(ctx, exec, *setter) @@ -4059,7 +4152,7 @@ func (organization0 *Organization) AttachHistoryLinelocations(ctx context.Contex func insertOrganizationHistoryLocationtrackings0(ctx context.Context, exec bob.Executor, historyLocationtrackings1 []*HistoryLocationtrackingSetter, organization0 *Organization) (HistoryLocationtrackingSlice, error) { for i := range historyLocationtrackings1 { - historyLocationtrackings1[i].OrganizationID = omitnull.From(organization0.ID) + historyLocationtrackings1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryLocationtrackings.Insert(bob.ToMods(historyLocationtrackings1...)).All(ctx, exec) @@ -4072,7 +4165,7 @@ func insertOrganizationHistoryLocationtrackings0(ctx context.Context, exec bob.E func attachOrganizationHistoryLocationtrackings0(ctx context.Context, exec bob.Executor, count int, historyLocationtrackings1 HistoryLocationtrackingSlice, organization0 *Organization) (HistoryLocationtrackingSlice, error) { setter := &HistoryLocationtrackingSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyLocationtrackings1.UpdateAll(ctx, exec, *setter) @@ -4127,7 +4220,7 @@ func (organization0 *Organization) AttachHistoryLocationtrackings(ctx context.Co func insertOrganizationHistoryMosquitoinspections0(ctx context.Context, exec bob.Executor, historyMosquitoinspections1 []*HistoryMosquitoinspectionSetter, organization0 *Organization) (HistoryMosquitoinspectionSlice, error) { for i := range historyMosquitoinspections1 { - historyMosquitoinspections1[i].OrganizationID = omitnull.From(organization0.ID) + historyMosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryMosquitoinspections.Insert(bob.ToMods(historyMosquitoinspections1...)).All(ctx, exec) @@ -4140,7 +4233,7 @@ func insertOrganizationHistoryMosquitoinspections0(ctx context.Context, exec bob func attachOrganizationHistoryMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, historyMosquitoinspections1 HistoryMosquitoinspectionSlice, organization0 *Organization) (HistoryMosquitoinspectionSlice, error) { setter := &HistoryMosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyMosquitoinspections1.UpdateAll(ctx, exec, *setter) @@ -4195,7 +4288,7 @@ func (organization0 *Organization) AttachHistoryMosquitoinspections(ctx context. func insertOrganizationHistoryPointlocations0(ctx context.Context, exec bob.Executor, historyPointlocations1 []*HistoryPointlocationSetter, organization0 *Organization) (HistoryPointlocationSlice, error) { for i := range historyPointlocations1 { - historyPointlocations1[i].OrganizationID = omitnull.From(organization0.ID) + historyPointlocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryPointlocations.Insert(bob.ToMods(historyPointlocations1...)).All(ctx, exec) @@ -4208,7 +4301,7 @@ func insertOrganizationHistoryPointlocations0(ctx context.Context, exec bob.Exec func attachOrganizationHistoryPointlocations0(ctx context.Context, exec bob.Executor, count int, historyPointlocations1 HistoryPointlocationSlice, organization0 *Organization) (HistoryPointlocationSlice, error) { setter := &HistoryPointlocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyPointlocations1.UpdateAll(ctx, exec, *setter) @@ -4263,7 +4356,7 @@ func (organization0 *Organization) AttachHistoryPointlocations(ctx context.Conte func insertOrganizationHistoryPolygonlocations0(ctx context.Context, exec bob.Executor, historyPolygonlocations1 []*HistoryPolygonlocationSetter, organization0 *Organization) (HistoryPolygonlocationSlice, error) { for i := range historyPolygonlocations1 { - historyPolygonlocations1[i].OrganizationID = omitnull.From(organization0.ID) + historyPolygonlocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryPolygonlocations.Insert(bob.ToMods(historyPolygonlocations1...)).All(ctx, exec) @@ -4276,7 +4369,7 @@ func insertOrganizationHistoryPolygonlocations0(ctx context.Context, exec bob.Ex func attachOrganizationHistoryPolygonlocations0(ctx context.Context, exec bob.Executor, count int, historyPolygonlocations1 HistoryPolygonlocationSlice, organization0 *Organization) (HistoryPolygonlocationSlice, error) { setter := &HistoryPolygonlocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyPolygonlocations1.UpdateAll(ctx, exec, *setter) @@ -4331,7 +4424,7 @@ func (organization0 *Organization) AttachHistoryPolygonlocations(ctx context.Con func insertOrganizationHistoryPools0(ctx context.Context, exec bob.Executor, historyPools1 []*HistoryPoolSetter, organization0 *Organization) (HistoryPoolSlice, error) { for i := range historyPools1 { - historyPools1[i].OrganizationID = omitnull.From(organization0.ID) + historyPools1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryPools.Insert(bob.ToMods(historyPools1...)).All(ctx, exec) @@ -4344,7 +4437,7 @@ func insertOrganizationHistoryPools0(ctx context.Context, exec bob.Executor, his func attachOrganizationHistoryPools0(ctx context.Context, exec bob.Executor, count int, historyPools1 HistoryPoolSlice, organization0 *Organization) (HistoryPoolSlice, error) { setter := &HistoryPoolSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyPools1.UpdateAll(ctx, exec, *setter) @@ -4399,7 +4492,7 @@ func (organization0 *Organization) AttachHistoryPools(ctx context.Context, exec func insertOrganizationHistoryPooldetails0(ctx context.Context, exec bob.Executor, historyPooldetails1 []*HistoryPooldetailSetter, organization0 *Organization) (HistoryPooldetailSlice, error) { for i := range historyPooldetails1 { - historyPooldetails1[i].OrganizationID = omitnull.From(organization0.ID) + historyPooldetails1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryPooldetails.Insert(bob.ToMods(historyPooldetails1...)).All(ctx, exec) @@ -4412,7 +4505,7 @@ func insertOrganizationHistoryPooldetails0(ctx context.Context, exec bob.Executo func attachOrganizationHistoryPooldetails0(ctx context.Context, exec bob.Executor, count int, historyPooldetails1 HistoryPooldetailSlice, organization0 *Organization) (HistoryPooldetailSlice, error) { setter := &HistoryPooldetailSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyPooldetails1.UpdateAll(ctx, exec, *setter) @@ -4467,7 +4560,7 @@ func (organization0 *Organization) AttachHistoryPooldetails(ctx context.Context, func insertOrganizationHistoryProposedtreatmentareas0(ctx context.Context, exec bob.Executor, historyProposedtreatmentareas1 []*HistoryProposedtreatmentareaSetter, organization0 *Organization) (HistoryProposedtreatmentareaSlice, error) { for i := range historyProposedtreatmentareas1 { - historyProposedtreatmentareas1[i].OrganizationID = omitnull.From(organization0.ID) + historyProposedtreatmentareas1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryProposedtreatmentareas.Insert(bob.ToMods(historyProposedtreatmentareas1...)).All(ctx, exec) @@ -4480,7 +4573,7 @@ func insertOrganizationHistoryProposedtreatmentareas0(ctx context.Context, exec func attachOrganizationHistoryProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, historyProposedtreatmentareas1 HistoryProposedtreatmentareaSlice, organization0 *Organization) (HistoryProposedtreatmentareaSlice, error) { setter := &HistoryProposedtreatmentareaSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyProposedtreatmentareas1.UpdateAll(ctx, exec, *setter) @@ -4535,7 +4628,7 @@ func (organization0 *Organization) AttachHistoryProposedtreatmentareas(ctx conte func insertOrganizationHistoryQamosquitoinspections0(ctx context.Context, exec bob.Executor, historyQamosquitoinspections1 []*HistoryQamosquitoinspectionSetter, organization0 *Organization) (HistoryQamosquitoinspectionSlice, error) { for i := range historyQamosquitoinspections1 { - historyQamosquitoinspections1[i].OrganizationID = omitnull.From(organization0.ID) + historyQamosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryQamosquitoinspections.Insert(bob.ToMods(historyQamosquitoinspections1...)).All(ctx, exec) @@ -4548,7 +4641,7 @@ func insertOrganizationHistoryQamosquitoinspections0(ctx context.Context, exec b func attachOrganizationHistoryQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, historyQamosquitoinspections1 HistoryQamosquitoinspectionSlice, organization0 *Organization) (HistoryQamosquitoinspectionSlice, error) { setter := &HistoryQamosquitoinspectionSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyQamosquitoinspections1.UpdateAll(ctx, exec, *setter) @@ -4603,7 +4696,7 @@ func (organization0 *Organization) AttachHistoryQamosquitoinspections(ctx contex func insertOrganizationHistoryRodentlocations0(ctx context.Context, exec bob.Executor, historyRodentlocations1 []*HistoryRodentlocationSetter, organization0 *Organization) (HistoryRodentlocationSlice, error) { for i := range historyRodentlocations1 { - historyRodentlocations1[i].OrganizationID = omitnull.From(organization0.ID) + historyRodentlocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryRodentlocations.Insert(bob.ToMods(historyRodentlocations1...)).All(ctx, exec) @@ -4616,7 +4709,7 @@ func insertOrganizationHistoryRodentlocations0(ctx context.Context, exec bob.Exe func attachOrganizationHistoryRodentlocations0(ctx context.Context, exec bob.Executor, count int, historyRodentlocations1 HistoryRodentlocationSlice, organization0 *Organization) (HistoryRodentlocationSlice, error) { setter := &HistoryRodentlocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyRodentlocations1.UpdateAll(ctx, exec, *setter) @@ -4671,7 +4764,7 @@ func (organization0 *Organization) AttachHistoryRodentlocations(ctx context.Cont func insertOrganizationHistorySamplecollections0(ctx context.Context, exec bob.Executor, historySamplecollections1 []*HistorySamplecollectionSetter, organization0 *Organization) (HistorySamplecollectionSlice, error) { for i := range historySamplecollections1 { - historySamplecollections1[i].OrganizationID = omitnull.From(organization0.ID) + historySamplecollections1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistorySamplecollections.Insert(bob.ToMods(historySamplecollections1...)).All(ctx, exec) @@ -4684,7 +4777,7 @@ func insertOrganizationHistorySamplecollections0(ctx context.Context, exec bob.E func attachOrganizationHistorySamplecollections0(ctx context.Context, exec bob.Executor, count int, historySamplecollections1 HistorySamplecollectionSlice, organization0 *Organization) (HistorySamplecollectionSlice, error) { setter := &HistorySamplecollectionSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historySamplecollections1.UpdateAll(ctx, exec, *setter) @@ -4739,7 +4832,7 @@ func (organization0 *Organization) AttachHistorySamplecollections(ctx context.Co func insertOrganizationHistorySamplelocations0(ctx context.Context, exec bob.Executor, historySamplelocations1 []*HistorySamplelocationSetter, organization0 *Organization) (HistorySamplelocationSlice, error) { for i := range historySamplelocations1 { - historySamplelocations1[i].OrganizationID = omitnull.From(organization0.ID) + historySamplelocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistorySamplelocations.Insert(bob.ToMods(historySamplelocations1...)).All(ctx, exec) @@ -4752,7 +4845,7 @@ func insertOrganizationHistorySamplelocations0(ctx context.Context, exec bob.Exe func attachOrganizationHistorySamplelocations0(ctx context.Context, exec bob.Executor, count int, historySamplelocations1 HistorySamplelocationSlice, organization0 *Organization) (HistorySamplelocationSlice, error) { setter := &HistorySamplelocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historySamplelocations1.UpdateAll(ctx, exec, *setter) @@ -4807,7 +4900,7 @@ func (organization0 *Organization) AttachHistorySamplelocations(ctx context.Cont func insertOrganizationHistoryServicerequests0(ctx context.Context, exec bob.Executor, historyServicerequests1 []*HistoryServicerequestSetter, organization0 *Organization) (HistoryServicerequestSlice, error) { for i := range historyServicerequests1 { - historyServicerequests1[i].OrganizationID = omitnull.From(organization0.ID) + historyServicerequests1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryServicerequests.Insert(bob.ToMods(historyServicerequests1...)).All(ctx, exec) @@ -4820,7 +4913,7 @@ func insertOrganizationHistoryServicerequests0(ctx context.Context, exec bob.Exe func attachOrganizationHistoryServicerequests0(ctx context.Context, exec bob.Executor, count int, historyServicerequests1 HistoryServicerequestSlice, organization0 *Organization) (HistoryServicerequestSlice, error) { setter := &HistoryServicerequestSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyServicerequests1.UpdateAll(ctx, exec, *setter) @@ -4875,7 +4968,7 @@ func (organization0 *Organization) AttachHistoryServicerequests(ctx context.Cont func insertOrganizationHistorySpeciesabundances0(ctx context.Context, exec bob.Executor, historySpeciesabundances1 []*HistorySpeciesabundanceSetter, organization0 *Organization) (HistorySpeciesabundanceSlice, error) { for i := range historySpeciesabundances1 { - historySpeciesabundances1[i].OrganizationID = omitnull.From(organization0.ID) + historySpeciesabundances1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistorySpeciesabundances.Insert(bob.ToMods(historySpeciesabundances1...)).All(ctx, exec) @@ -4888,7 +4981,7 @@ func insertOrganizationHistorySpeciesabundances0(ctx context.Context, exec bob.E func attachOrganizationHistorySpeciesabundances0(ctx context.Context, exec bob.Executor, count int, historySpeciesabundances1 HistorySpeciesabundanceSlice, organization0 *Organization) (HistorySpeciesabundanceSlice, error) { setter := &HistorySpeciesabundanceSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historySpeciesabundances1.UpdateAll(ctx, exec, *setter) @@ -4943,7 +5036,7 @@ func (organization0 *Organization) AttachHistorySpeciesabundances(ctx context.Co func insertOrganizationHistoryStormdrains0(ctx context.Context, exec bob.Executor, historyStormdrains1 []*HistoryStormdrainSetter, organization0 *Organization) (HistoryStormdrainSlice, error) { for i := range historyStormdrains1 { - historyStormdrains1[i].OrganizationID = omitnull.From(organization0.ID) + historyStormdrains1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryStormdrains.Insert(bob.ToMods(historyStormdrains1...)).All(ctx, exec) @@ -4956,7 +5049,7 @@ func insertOrganizationHistoryStormdrains0(ctx context.Context, exec bob.Executo func attachOrganizationHistoryStormdrains0(ctx context.Context, exec bob.Executor, count int, historyStormdrains1 HistoryStormdrainSlice, organization0 *Organization) (HistoryStormdrainSlice, error) { setter := &HistoryStormdrainSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyStormdrains1.UpdateAll(ctx, exec, *setter) @@ -5011,7 +5104,7 @@ func (organization0 *Organization) AttachHistoryStormdrains(ctx context.Context, func insertOrganizationHistoryTimecards0(ctx context.Context, exec bob.Executor, historyTimecards1 []*HistoryTimecardSetter, organization0 *Organization) (HistoryTimecardSlice, error) { for i := range historyTimecards1 { - historyTimecards1[i].OrganizationID = omitnull.From(organization0.ID) + historyTimecards1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryTimecards.Insert(bob.ToMods(historyTimecards1...)).All(ctx, exec) @@ -5024,7 +5117,7 @@ func insertOrganizationHistoryTimecards0(ctx context.Context, exec bob.Executor, func attachOrganizationHistoryTimecards0(ctx context.Context, exec bob.Executor, count int, historyTimecards1 HistoryTimecardSlice, organization0 *Organization) (HistoryTimecardSlice, error) { setter := &HistoryTimecardSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyTimecards1.UpdateAll(ctx, exec, *setter) @@ -5079,7 +5172,7 @@ func (organization0 *Organization) AttachHistoryTimecards(ctx context.Context, e func insertOrganizationHistoryTrapdata0(ctx context.Context, exec bob.Executor, historyTrapdata1 []*HistoryTrapdatumSetter, organization0 *Organization) (HistoryTrapdatumSlice, error) { for i := range historyTrapdata1 { - historyTrapdata1[i].OrganizationID = omitnull.From(organization0.ID) + historyTrapdata1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryTrapdata.Insert(bob.ToMods(historyTrapdata1...)).All(ctx, exec) @@ -5092,7 +5185,7 @@ func insertOrganizationHistoryTrapdata0(ctx context.Context, exec bob.Executor, func attachOrganizationHistoryTrapdata0(ctx context.Context, exec bob.Executor, count int, historyTrapdata1 HistoryTrapdatumSlice, organization0 *Organization) (HistoryTrapdatumSlice, error) { setter := &HistoryTrapdatumSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyTrapdata1.UpdateAll(ctx, exec, *setter) @@ -5147,7 +5240,7 @@ func (organization0 *Organization) AttachHistoryTrapdata(ctx context.Context, ex func insertOrganizationHistoryTraplocations0(ctx context.Context, exec bob.Executor, historyTraplocations1 []*HistoryTraplocationSetter, organization0 *Organization) (HistoryTraplocationSlice, error) { for i := range historyTraplocations1 { - historyTraplocations1[i].OrganizationID = omitnull.From(organization0.ID) + historyTraplocations1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryTraplocations.Insert(bob.ToMods(historyTraplocations1...)).All(ctx, exec) @@ -5160,7 +5253,7 @@ func insertOrganizationHistoryTraplocations0(ctx context.Context, exec bob.Execu func attachOrganizationHistoryTraplocations0(ctx context.Context, exec bob.Executor, count int, historyTraplocations1 HistoryTraplocationSlice, organization0 *Organization) (HistoryTraplocationSlice, error) { setter := &HistoryTraplocationSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyTraplocations1.UpdateAll(ctx, exec, *setter) @@ -5215,7 +5308,7 @@ func (organization0 *Organization) AttachHistoryTraplocations(ctx context.Contex func insertOrganizationHistoryTreatments0(ctx context.Context, exec bob.Executor, historyTreatments1 []*HistoryTreatmentSetter, organization0 *Organization) (HistoryTreatmentSlice, error) { for i := range historyTreatments1 { - historyTreatments1[i].OrganizationID = omitnull.From(organization0.ID) + historyTreatments1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryTreatments.Insert(bob.ToMods(historyTreatments1...)).All(ctx, exec) @@ -5228,7 +5321,7 @@ func insertOrganizationHistoryTreatments0(ctx context.Context, exec bob.Executor func attachOrganizationHistoryTreatments0(ctx context.Context, exec bob.Executor, count int, historyTreatments1 HistoryTreatmentSlice, organization0 *Organization) (HistoryTreatmentSlice, error) { setter := &HistoryTreatmentSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyTreatments1.UpdateAll(ctx, exec, *setter) @@ -5283,7 +5376,7 @@ func (organization0 *Organization) AttachHistoryTreatments(ctx context.Context, func insertOrganizationHistoryTreatmentareas0(ctx context.Context, exec bob.Executor, historyTreatmentareas1 []*HistoryTreatmentareaSetter, organization0 *Organization) (HistoryTreatmentareaSlice, error) { for i := range historyTreatmentareas1 { - historyTreatmentareas1[i].OrganizationID = omitnull.From(organization0.ID) + historyTreatmentareas1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryTreatmentareas.Insert(bob.ToMods(historyTreatmentareas1...)).All(ctx, exec) @@ -5296,7 +5389,7 @@ func insertOrganizationHistoryTreatmentareas0(ctx context.Context, exec bob.Exec func attachOrganizationHistoryTreatmentareas0(ctx context.Context, exec bob.Executor, count int, historyTreatmentareas1 HistoryTreatmentareaSlice, organization0 *Organization) (HistoryTreatmentareaSlice, error) { setter := &HistoryTreatmentareaSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyTreatmentareas1.UpdateAll(ctx, exec, *setter) @@ -5351,7 +5444,7 @@ func (organization0 *Organization) AttachHistoryTreatmentareas(ctx context.Conte func insertOrganizationHistoryZones0(ctx context.Context, exec bob.Executor, historyZones1 []*HistoryZoneSetter, organization0 *Organization) (HistoryZoneSlice, error) { for i := range historyZones1 { - historyZones1[i].OrganizationID = omitnull.From(organization0.ID) + historyZones1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryZones.Insert(bob.ToMods(historyZones1...)).All(ctx, exec) @@ -5364,7 +5457,7 @@ func insertOrganizationHistoryZones0(ctx context.Context, exec bob.Executor, his func attachOrganizationHistoryZones0(ctx context.Context, exec bob.Executor, count int, historyZones1 HistoryZoneSlice, organization0 *Organization) (HistoryZoneSlice, error) { setter := &HistoryZoneSetter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyZones1.UpdateAll(ctx, exec, *setter) @@ -5419,7 +5512,7 @@ func (organization0 *Organization) AttachHistoryZones(ctx context.Context, exec func insertOrganizationHistoryZones2s0(ctx context.Context, exec bob.Executor, historyZones2s1 []*HistoryZones2Setter, organization0 *Organization) (HistoryZones2Slice, error) { for i := range historyZones2s1 { - historyZones2s1[i].OrganizationID = omitnull.From(organization0.ID) + historyZones2s1[i].OrganizationID = omit.From(organization0.ID) } ret, err := HistoryZones2s.Insert(bob.ToMods(historyZones2s1...)).All(ctx, exec) @@ -5432,7 +5525,7 @@ func insertOrganizationHistoryZones2s0(ctx context.Context, exec bob.Executor, h func attachOrganizationHistoryZones2s0(ctx context.Context, exec bob.Executor, count int, historyZones2s1 HistoryZones2Slice, organization0 *Organization) (HistoryZones2Slice, error) { setter := &HistoryZones2Setter{ - OrganizationID: omitnull.From(organization0.ID), + OrganizationID: omit.From(organization0.ID), } err := historyZones2s1.UpdateAll(ctx, exec, *setter) @@ -5581,6 +5674,20 @@ func (o *Organization) Preload(name string, retrieved any) error { } switch name { + case "FieldseekerSyncs": + rels, ok := retrieved.(FieldseekerSyncSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.FieldseekerSyncs = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil case "FSContainerrelates": rels, ok := retrieved.(FSContainerrelateSlice) if !ok { @@ -6363,6 +6470,7 @@ func buildOrganizationPreloader() organizationPreloader { } type organizationThenLoader[Q orm.Loadable] struct { + FieldseekerSyncs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] FSContainerrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] FSFieldscoutinglogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] FSHabitatrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] @@ -6421,6 +6529,9 @@ type organizationThenLoader[Q orm.Loadable] struct { } func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { + type FieldseekerSyncsLoadInterface interface { + LoadFieldseekerSyncs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type FSContainerrelatesLoadInterface interface { LoadFSContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -6588,6 +6699,12 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { } return organizationThenLoader[Q]{ + FieldseekerSyncs: thenLoadBuilder[Q]( + "FieldseekerSyncs", + func(ctx context.Context, exec bob.Executor, retrieved FieldseekerSyncsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFieldseekerSyncs(ctx, exec, mods...) + }, + ), FSContainerrelates: thenLoadBuilder[Q]( "FSContainerrelates", func(ctx context.Context, exec bob.Executor, retrieved FSContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -6921,6 +7038,67 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { } } +// LoadFieldseekerSyncs loads the organization's FieldseekerSyncs into the .R struct +func (o *Organization) LoadFieldseekerSyncs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FieldseekerSyncs = nil + + related, err := o.FieldseekerSyncs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.FieldseekerSyncs = related + return nil +} + +// LoadFieldseekerSyncs loads the organization's FieldseekerSyncs into the .R struct +func (os OrganizationSlice) LoadFieldseekerSyncs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerSyncs, err := os.FieldseekerSyncs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.FieldseekerSyncs = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerSyncs { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.FieldseekerSyncs = append(o.R.FieldseekerSyncs, rel) + } + } + + return nil +} + // LoadFSContainerrelates loads the organization's FSContainerrelates into the .R struct func (o *Organization) LoadFSContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -6969,10 +7147,7 @@ func (os OrganizationSlice) LoadFSContainerrelates(ctx context.Context, exec bob for _, rel := range fsContainerrelates { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7033,10 +7208,7 @@ func (os OrganizationSlice) LoadFSFieldscoutinglogs(ctx context.Context, exec bo for _, rel := range fsFieldscoutinglogs { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7097,10 +7269,7 @@ func (os OrganizationSlice) LoadFSHabitatrelates(ctx context.Context, exec bob.E for _, rel := range fsHabitatrelates { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7161,10 +7330,7 @@ func (os OrganizationSlice) LoadFSInspectionsamples(ctx context.Context, exec bo for _, rel := range fsInspectionsamples { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7225,10 +7391,7 @@ func (os OrganizationSlice) LoadFSInspectionsampledetails(ctx context.Context, e for _, rel := range fsInspectionsampledetails { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7289,10 +7452,7 @@ func (os OrganizationSlice) LoadFSLinelocations(ctx context.Context, exec bob.Ex for _, rel := range fsLinelocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7353,10 +7513,7 @@ func (os OrganizationSlice) LoadFSLocationtrackings(ctx context.Context, exec bo for _, rel := range fsLocationtrackings { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7417,10 +7574,7 @@ func (os OrganizationSlice) LoadFSMosquitoinspections(ctx context.Context, exec for _, rel := range fsMosquitoinspections { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7481,10 +7635,7 @@ func (os OrganizationSlice) LoadFSPointlocations(ctx context.Context, exec bob.E for _, rel := range fsPointlocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7545,10 +7696,7 @@ func (os OrganizationSlice) LoadFSPolygonlocations(ctx context.Context, exec bob for _, rel := range fsPolygonlocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7609,10 +7757,7 @@ func (os OrganizationSlice) LoadFSPools(ctx context.Context, exec bob.Executor, for _, rel := range fsPools { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7673,10 +7818,7 @@ func (os OrganizationSlice) LoadFSPooldetails(ctx context.Context, exec bob.Exec for _, rel := range fsPooldetails { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7737,10 +7879,7 @@ func (os OrganizationSlice) LoadFSProposedtreatmentareas(ctx context.Context, ex for _, rel := range fsProposedtreatmentareas { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7801,10 +7940,7 @@ func (os OrganizationSlice) LoadFSQamosquitoinspections(ctx context.Context, exe for _, rel := range fsQamosquitoinspections { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7865,10 +8001,7 @@ func (os OrganizationSlice) LoadFSRodentlocations(ctx context.Context, exec bob. for _, rel := range fsRodentlocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7929,10 +8062,7 @@ func (os OrganizationSlice) LoadFSSamplecollections(ctx context.Context, exec bo for _, rel := range fsSamplecollections { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -7993,10 +8123,7 @@ func (os OrganizationSlice) LoadFSSamplelocations(ctx context.Context, exec bob. for _, rel := range fsSamplelocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8057,10 +8184,7 @@ func (os OrganizationSlice) LoadFSServicerequests(ctx context.Context, exec bob. for _, rel := range fsServicerequests { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8121,10 +8245,7 @@ func (os OrganizationSlice) LoadFSSpeciesabundances(ctx context.Context, exec bo for _, rel := range fsSpeciesabundances { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8185,10 +8306,7 @@ func (os OrganizationSlice) LoadFSStormdrains(ctx context.Context, exec bob.Exec for _, rel := range fsStormdrains { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8249,10 +8367,7 @@ func (os OrganizationSlice) LoadFSTimecards(ctx context.Context, exec bob.Execut for _, rel := range fsTimecards { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8313,10 +8428,7 @@ func (os OrganizationSlice) LoadFSTrapdata(ctx context.Context, exec bob.Executo for _, rel := range fsTrapdata { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8377,10 +8489,7 @@ func (os OrganizationSlice) LoadFSTraplocations(ctx context.Context, exec bob.Ex for _, rel := range fsTraplocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8441,10 +8550,7 @@ func (os OrganizationSlice) LoadFSTreatments(ctx context.Context, exec bob.Execu for _, rel := range fsTreatments { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8505,10 +8611,7 @@ func (os OrganizationSlice) LoadFSTreatmentareas(ctx context.Context, exec bob.E for _, rel := range fsTreatmentareas { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8569,10 +8672,7 @@ func (os OrganizationSlice) LoadFSZones(ctx context.Context, exec bob.Executor, for _, rel := range fsZones { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8633,10 +8733,7 @@ func (os OrganizationSlice) LoadFSZones2s(ctx context.Context, exec bob.Executor for _, rel := range fsZones2s { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8697,10 +8794,7 @@ func (os OrganizationSlice) LoadHistoryContainerrelates(ctx context.Context, exe for _, rel := range historyContainerrelates { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8761,10 +8855,7 @@ func (os OrganizationSlice) LoadHistoryFieldscoutinglogs(ctx context.Context, ex for _, rel := range historyFieldscoutinglogs { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8825,10 +8916,7 @@ func (os OrganizationSlice) LoadHistoryHabitatrelates(ctx context.Context, exec for _, rel := range historyHabitatrelates { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8889,10 +8977,7 @@ func (os OrganizationSlice) LoadHistoryInspectionsamples(ctx context.Context, ex for _, rel := range historyInspectionsamples { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -8953,10 +9038,7 @@ func (os OrganizationSlice) LoadHistoryInspectionsampledetails(ctx context.Conte for _, rel := range historyInspectionsampledetails { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9017,10 +9099,7 @@ func (os OrganizationSlice) LoadHistoryLinelocations(ctx context.Context, exec b for _, rel := range historyLinelocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9081,10 +9160,7 @@ func (os OrganizationSlice) LoadHistoryLocationtrackings(ctx context.Context, ex for _, rel := range historyLocationtrackings { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9145,10 +9221,7 @@ func (os OrganizationSlice) LoadHistoryMosquitoinspections(ctx context.Context, for _, rel := range historyMosquitoinspections { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9209,10 +9282,7 @@ func (os OrganizationSlice) LoadHistoryPointlocations(ctx context.Context, exec for _, rel := range historyPointlocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9273,10 +9343,7 @@ func (os OrganizationSlice) LoadHistoryPolygonlocations(ctx context.Context, exe for _, rel := range historyPolygonlocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9337,10 +9404,7 @@ func (os OrganizationSlice) LoadHistoryPools(ctx context.Context, exec bob.Execu for _, rel := range historyPools { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9401,10 +9465,7 @@ func (os OrganizationSlice) LoadHistoryPooldetails(ctx context.Context, exec bob for _, rel := range historyPooldetails { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9465,10 +9526,7 @@ func (os OrganizationSlice) LoadHistoryProposedtreatmentareas(ctx context.Contex for _, rel := range historyProposedtreatmentareas { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9529,10 +9587,7 @@ func (os OrganizationSlice) LoadHistoryQamosquitoinspections(ctx context.Context for _, rel := range historyQamosquitoinspections { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9593,10 +9648,7 @@ func (os OrganizationSlice) LoadHistoryRodentlocations(ctx context.Context, exec for _, rel := range historyRodentlocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9657,10 +9709,7 @@ func (os OrganizationSlice) LoadHistorySamplecollections(ctx context.Context, ex for _, rel := range historySamplecollections { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9721,10 +9770,7 @@ func (os OrganizationSlice) LoadHistorySamplelocations(ctx context.Context, exec for _, rel := range historySamplelocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9785,10 +9831,7 @@ func (os OrganizationSlice) LoadHistoryServicerequests(ctx context.Context, exec for _, rel := range historyServicerequests { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9849,10 +9892,7 @@ func (os OrganizationSlice) LoadHistorySpeciesabundances(ctx context.Context, ex for _, rel := range historySpeciesabundances { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9913,10 +9953,7 @@ func (os OrganizationSlice) LoadHistoryStormdrains(ctx context.Context, exec bob for _, rel := range historyStormdrains { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -9977,10 +10014,7 @@ func (os OrganizationSlice) LoadHistoryTimecards(ctx context.Context, exec bob.E for _, rel := range historyTimecards { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -10041,10 +10075,7 @@ func (os OrganizationSlice) LoadHistoryTrapdata(ctx context.Context, exec bob.Ex for _, rel := range historyTrapdata { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -10105,10 +10136,7 @@ func (os OrganizationSlice) LoadHistoryTraplocations(ctx context.Context, exec b for _, rel := range historyTraplocations { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -10169,10 +10197,7 @@ func (os OrganizationSlice) LoadHistoryTreatments(ctx context.Context, exec bob. for _, rel := range historyTreatments { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -10233,10 +10258,7 @@ func (os OrganizationSlice) LoadHistoryTreatmentareas(ctx context.Context, exec for _, rel := range historyTreatmentareas { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -10297,10 +10319,7 @@ func (os OrganizationSlice) LoadHistoryZones(ctx context.Context, exec bob.Execu for _, rel := range historyZones { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -10361,10 +10380,7 @@ func (os OrganizationSlice) LoadHistoryZones2s(ctx context.Context, exec bob.Exe for _, rel := range historyZones2s { - if !rel.OrganizationID.IsValue() { - continue - } - if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) { + if !(o.ID == rel.OrganizationID) { continue } @@ -10443,6 +10459,7 @@ func (os OrganizationSlice) LoadUser(ctx context.Context, exec bob.Executor, mod type organizationJoins[Q dialect.Joinable] struct { typ string + FieldseekerSyncs modAs[Q, fieldseekerSyncColumns] FSContainerrelates modAs[Q, fsContainerrelateColumns] FSFieldscoutinglogs modAs[Q, fsFieldscoutinglogColumns] FSHabitatrelates modAs[Q, fsHabitatrelateColumns] @@ -10507,6 +10524,20 @@ func (j organizationJoins[Q]) aliasedAs(alias string) organizationJoins[Q] { func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ string) organizationJoins[Q] { return organizationJoins[Q]{ typ: typ, + FieldseekerSyncs: modAs[Q, fieldseekerSyncColumns]{ + c: FieldseekerSyncs.Columns, + f: func(to fieldseekerSyncColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerSyncs.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, FSContainerrelates: modAs[Q, fsContainerrelateColumns]{ c: FSContainerrelates.Columns, f: func(to fsContainerrelateColumns) bob.Mod[Q] {